Get Work Record
GET /api/v1/work-records/:id
Retrieves a single work record by its ID, including the run's output and the config it ran with.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The work record's unique identifier |
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
fields | string | all | Comma-separated field names |
include | string | none | Comma-separated extras: report (the run's markdown report), supporting_docs (attached documents and files, without their content) |
Example Request
curl -X GET "https://orchestrator.assemblyline.sh/api/v1/work-records/wr_abc123def" \
-H "api-key: al_xxxxxxxxxxxx" \
-H "api-secret: xxxxxxxxxxxxxxxx"
Response - Completed
{
"data": {
"id": "wr_abc123def",
"station": "st_def456",
"status": "completed",
"output": { "done_count": 3, "failed_count": 0 },
"config_snapshot": { "source": "erpnext" },
"config_overrides": null,
"started_at": "2024-01-15T10:30:00Z",
"completed_at": "2024-01-15T10:30:10Z",
"performed_by": "api",
"error": null,
"created_at": "2024-01-15T10:30:00Z",
"tags": [
{ "id": "tag_abc123", "name": "reviewed", "color": "#38c172" }
]
}
}
output is what the station's handler returned. config_snapshot is the station's config
with the run's config_overrides merged over it, frozen when the run was queued.
Response - Failed
{
"data": {
"id": "wr_xyz789abc",
"station": "st_def456",
"status": "failed",
"output": null,
"config_snapshot": { "source": "erpnext" },
"config_overrides": null,
"started_at": "2024-01-15T11:00:00Z",
"completed_at": "2024-01-15T11:00:03Z",
"performed_by": "api",
"error": "HTTP request failed with status 500",
"created_at": "2024-01-15T11:00:00Z",
"tags": []
}
}
Response - Running
{
"data": {
"id": "wr_running123",
"station": "st_def456",
"status": "running",
"output": null,
"config_snapshot": { "source": "erpnext", "period": "2024-01" },
"config_overrides": { "period": "2024-01" },
"started_at": "2024-01-15T12:00:00Z",
"completed_at": null,
"performed_by": "api",
"error": null,
"created_at": "2024-01-15T12:00:00Z",
"tags": []
}
}
Polling for Completion
After running a station, poll this endpoint to check completion:
async function waitForCompletion(work_record_id) {
while (true) {
const response = await fetch(
`https://orchestrator.assemblyline.sh/api/v1/work-records/${work_record_id}`,
{ headers: { 'api-key': key, 'api-secret': secret } }
);
const { data } = await response.json();
if (data.status === 'completed' || data.status === 'failed') {
return data;
}
await new Promise(resolve => setTimeout(resolve, 1000));
}
}
Errors
| Code | Description |
|---|---|
401 | Invalid or missing API credentials |
403 | API key lacks work_records:read permission |
404 | Work record not found |