Error Codes

The API uses standard HTTP status codes and returns structured error responses.

Error Response Format

All errors return a JSON object with an error field:

{
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable description"
  }
}

HTTP Status Codes

StatusDescription
200Success
201Created successfully
204Deleted successfully (no content)
400Bad request - validation error
401Unauthorized - invalid or missing credentials
403Forbidden - insufficient permissions
404Not found
500Internal server error

Error Codes

Authentication Errors (401)

CodeMessageDescription
UNAUTHORIZEDMissing API credentialsNo api-key or api-secret header provided
UNAUTHORIZEDInvalid API credentialsKey or secret is incorrect
UNAUTHORIZEDAPI key expiredKey has passed its expiry date

Permission Errors (403)

CodeMessageDescription
FORBIDDENAPI key lacks : permissionKey doesn't have required permission

Validation Errors (400)

CodeMessageDescription
INVALID_JSONInvalid JSON bodyRequest body is not valid JSON
VALIDATION_ERROR is requiredRequired field missing
VALIDATION_ERROR must be an arrayField type mismatch
CONSTRAINT_ERRORCannot delete station with associated work recordsForeign key constraint (pass ?cascade=true to override)

Not Found Errors (404)

CodeMessageDescription
NOT_FOUNDStation not foundResource 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."
  }
}