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

ParameterTypeDescription
idstringThe station's unique identifier or short_code

Query Parameters

ParameterTypeDefaultDescription
cascadebooleanfalseWhen 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_records for the station
  • All process_watchers (notification subscriptions)
  • Every supporting_documents row 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 /stations list (use ?include_archived=true to surface them)
  • Are blocked from execution (scheduler skips them; POST /run rejects 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:

DisabledArchived
ReversibleYesYes (via unarchive)
Shows in default listYesNo
IntentTemporary pausePermanent retirement, preserved for audit

Errors

CodeDescription
400 CONSTRAINT_ERRORStation has work records and ?cascade=true was not passed
401Invalid or missing API credentials
403API key lacks stations:delete permission
404Station not found