Delete Station
DELETE /api/v1/stations/:id[?cascade=true]
Also available at the canonical /api/v1/stations/:id (the /stations/* path is a deprecation alias that re-exports the same handler).
Permanently deletes a station definition. This action cannot be undone — prefer archive when the intent is to retire a station while preserving history.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The station's unique identifier or short_code |
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
cascade | boolean | false | When true, also delete every linked work record (and their dependent rows). When false, the request is rejected if any work records exist. |
Example Request
Delete a station with no work records
curl -X DELETE "https://orchestrator.assemblyline.sh/api/v1/stations/st_abc123" \
-H "api-key: al_xxxxxxxxxxxx" \
-H "api-secret: xxxxxxxxxxxxxxxx"
Cascade-delete a station that has work records
curl -X DELETE "https://orchestrator.assemblyline.sh/api/v1/stations/st_abc123?cascade=true" \
-H "api-key: al_xxxxxxxxxxxx" \
-H "api-secret: xxxxxxxxxxxxxxxx"
Response
Returns 204 No Content on success (empty response body).
What Cascade Deletes
When cascade=true is set, the underlying ON DELETE CASCADE foreign keys propagate the delete to every row that points at the station:
- All
work_recordsfor the station - All
process_watchers(notification subscriptions) - Every
supporting_documentsrow attached to the deleted work records
The operation is atomic — either every row is deleted or nothing is.
Important Considerations
Refused without cascade
Without ?cascade=true, the request returns 400 CONSTRAINT_ERROR if any work records reference the station. The error message names the count and points at the cascade flag and the archive alternative.
Running executions
If the station is currently executing (work records with status pending or running), cascade-delete still proceeds — those rows go away with the rest. The factory session may produce log lines about a vanished work record but the orchestrator side stays consistent.
Archived stations
Archived stations can be deleted normally — archive and delete are independent. If a station has no work records you can skip archive and delete directly.
Alternative: Archive Instead
When the intent is to retire a station while preserving history:
curl -X POST "https://orchestrator.assemblyline.sh/api/v1/stations/st_abc123/archive" \
-H "api-key: al_xxxxxxxxxxxx" \
-H "api-secret: xxxxxxxxxxxxxxxx"
Archived stations:
- Are hidden from the default
GET /stationslist (use?include_archived=trueto surface them) - Are blocked from execution (scheduler skips them;
POST /runrejects them) - Retain every work record and supporting document
- Can be revived via unarchive
See Archive Station for the full flow.
Alternative: Disable Instead
When the intent is a temporary pause (not a retirement), disable the station:
curl -X PUT "https://orchestrator.assemblyline.sh/api/v1/stations/st_abc123" \
-H "api-key: al_xxxxxxxxxxxx" \
-H "api-secret: xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{ "is_enabled": false }'
Disabled vs archived:
| Disabled | Archived | |
|---|---|---|
| Reversible | Yes | Yes (via unarchive) |
Shows in default list | Yes | No |
| Intent | Temporary pause | Permanent retirement, preserved for audit |
Errors
| Code | Description |
|---|---|
400 CONSTRAINT_ERROR | Station has work records and ?cascade=true was not passed |
401 | Invalid or missing API credentials |
403 | API key lacks stations:delete permission |
404 | Station not found |