Create Station

POST /api/v1/stations

Creates a new station definition in your organization.

Request Body

FieldTypeRequiredDescription
namestringYesStation name
descriptionstringNoHuman-readable description
conveyorobjectNoThe bins the station takes work from: { "from": "EX0/output" } or a list of bins. See Station
configobjectNoOne JSON object passed to the station's handler (default: {}). See Station
dependenciesarrayNoStation IDs that must complete first
is_enabledbooleanNoWhether 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

CodeDescription
400Validation error
401Invalid or missing API credentials
403API 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