Complete Task
POST /api/factory/complete
Stores the output of the station's handler on the work record and marks it completed.
Request Body
| Field | Type | Required | Description |
|---|
work_record_id | string | Yes | task.work_record.id from the poll response |
output | object | No | What the station's handler returned; stored as the work record's output |
curl -X POST "https://orchestrator.assemblyline.sh/api/factory/complete" \
-H "api-key: al_xxxxxxxxxxxxxxxxxx" \
-H "api-secret: xxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{ "work_record_id": "wr8Hn2QpLx1c", "output": { "done_count": 2, "failed_count": 1 } }'
Response
{ "success": true, "work_record_id": "wr8Hn2QpLx1c", "message": "Run completed" }
Errors
| Status | Code | Meaning |
|---|
400 | VALIDATION_ERROR | work_record_id is required |
400 | ALREADY_COMPLETED | The run is already completed |
403 | FORBIDDEN | The run belongs to another org |
404 | NOT_FOUND | No such run |