Error Codes
The API uses standard HTTP status codes and returns structured error responses.
All errors return a JSON object with an error field:
{
"error": {
"code": "ERROR_CODE",
"message": "Human-readable description"
}
}
HTTP Status Codes
| Status | Description |
|---|
200 | Success |
201 | Created successfully |
204 | Deleted successfully (no content) |
400 | Bad request - validation error |
401 | Unauthorized - invalid or missing credentials |
403 | Forbidden - insufficient permissions |
404 | Not found |
500 | Internal server error |
Error Codes
Authentication Errors (401)
| Code | Message | Description |
|---|
UNAUTHORIZED | Missing API credentials | No api-key or api-secret header provided |
UNAUTHORIZED | Invalid API credentials | Key or secret is incorrect |
UNAUTHORIZED | API key expired | Key has passed its expiry date |
Permission Errors (403)
| Code | Message | Description |
|---|
FORBIDDEN | API key lacks : permission | Key doesn't have required permission |
Validation Errors (400)
| Code | Message | Description |
|---|
INVALID_JSON | Invalid JSON body | Request body is not valid JSON |
VALIDATION_ERROR | is required | Required field missing |
VALIDATION_ERROR | must be an array | Field type mismatch |
CONSTRAINT_ERROR | Cannot delete station with associated work records | Foreign key constraint (pass ?cascade=true to override) |
Not Found Errors (404)
| Code | Message | Description |
|---|
NOT_FOUND | Station not found | Resource doesn't exist or not in your org |
Example Error Responses
Missing Required Field
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 '{}'
{
"error": {
"code": "VALIDATION_ERROR",
"message": "name is required"
}
}
Resource Not Found
curl -X GET "https://orchestrator.assemblyline.sh/api/v1/stations/nonexistent" \
-H "api-key: al_xxxxxxxxxxxx" \
-H "api-secret: xxxxxxxxxxxxxxxx"
{
"error": {
"code": "NOT_FOUND",
"message": "Station not found"
}
}
Constraint Violation
curl -X DELETE "https://orchestrator.assemblyline.sh/api/v1/stations/abc123" \
-H "api-key: al_xxxxxxxxxxxx" \
-H "api-secret: xxxxxxxxxxxxxxxx"
{
"error": {
"code": "CONSTRAINT_ERROR",
"message": "Cannot delete station with 5 associated work record(s). Pass ?cascade=true to also delete them, or archive the station instead."
}
}