Create Station
POST /api/v1/stations
Creates a new station definition in your organization.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Station name |
description | string | No | Human-readable description |
conveyor | object | No | The bins the station takes work from: { "from": "EX0/output" } or a list of bins. See Station |
config | object | No | One JSON object passed to the station's handler (default: {}). See Station |
dependencies | array | No | Station IDs that must complete first |
is_enabled | boolean | No | Whether station is enabled (default: true) |
Example Request
curl -X POST "https://orchestrator.assemblyline.sh/api/v1/stations" \
-H "api-key: al_xxxxxxxxxxxx" \
-H "api-secret: xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"short_code": "IV1",
"line": "IV",
"name": "validate_invoice",
"description": "Validate invoice format and amounts",
"conveyor": { "from": "IV0/output" },
"config": { "source": "erpnext" }
}'
IV1 runs the handler your factory defines in src/stations/IV1__validate_invoice/station.js.
Response
Returns the created station with status 201 Created:
{
"data": {
"id": "Lk2mP9qRs3Tu",
"short_code": "IV1",
"line": "IV",
"name": "validate_invoice",
"description": "Validate invoice format and amounts",
"config": { "source": "erpnext" },
"conveyor": { "from": "IV0/output" },
"dependencies": [],
"is_enabled": true,
"created_at": "2024-01-15T10:30:00Z",
"schedule_cron": null,
"schedule_timezone": "UTC",
"schedule_enabled": false,
"watch_enabled": false,
"archived_at": null
}
}
Minimal Example
name and line are required:
curl -X POST "https://orchestrator.assemblyline.sh/api/v1/stations" \
-H "api-key: al_xxxxxxxxxxxx" \
-H "api-secret: xxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{ "name": "Empty Station", "line": "EX" }'
Errors
| Code | Description |
|---|---|
400 | Validation error |
401 | Invalid or missing API credentials |
403 | API key lacks stations:create permission |
Validation Error Responses
{
"error": {
"code": "VALIDATION_ERROR",
"message": "name is required"
}
}
{
"error": {
"code": "VALIDATION_ERROR",
"message": "config must be an object"
}
}
A request that still sends steps is refused: a station has one config.
{
"error": {
"code": "VALIDATION_ERROR",
"message": "steps was removed: a station has one config. Send `config` (an object); update al-orc to 0.7 or later, and run lib-factory's migrate-to-stations in the factory"
}
}
See Also
- Station Object — full field reference
- Work Record Object — statuses, retries and how a run is queued and claimed