Worker API
Enroll outbound workers, claim and renew tasks, report progress/results and drain. Operators can also inspect the enrolled fleet.
Operations
| Operation | Method | Path |
|---|---|---|
bindSession | POST | /api/v2/sessions/bind |
claimTask | POST | /api/v2/worker/claim |
completeTask | POST | /api/v2/worker/complete |
drainWorker | POST | /api/v2/worker/drain |
enrollWorker | POST | /api/v2/worker/enroll |
reportProgress | POST | /api/v2/worker/progress |
renewLease | POST | /api/v2/worker/renew |
resumeTask | POST | /api/v2/worker/resume |
suspendTask | POST | /api/v2/worker/suspend |
listWorkers | GET | /api/v2/workers |
bindSession
Request body
{
"id": "string",
"lease_token": "string",
"session_id": "string",
"worker_id": "string"
}
Responses
| Status | Body | Meaning |
|---|---|---|
200 | SessionBinding | Successful operation |
400 | ErrorResponse | Structured API error |
401 | ErrorResponse | Missing or invalid credentials |
403 | ErrorResponse | Role or ownership denied |
404 | ErrorResponse | Resource unavailable to this identity |
409 | ErrorResponse | Revision, idempotency, immutable version or lease conflict |
410 | ErrorResponse | Session was deleted (session_deleted) |
413 | ErrorResponse | Structured API error |
422 | ErrorResponse | Capability input/output schema violation |
429 | ErrorResponse | Capacity exceeded |
500 | ErrorResponse | Structured API error |
503 | ErrorResponse | Structured API error |
Example response 200
{
"bound": false,
"session_id": "string"
}
claimTask
Request body
{
"worker_id": "string"
}
Responses
| Status | Body | Meaning |
|---|---|---|
200 | Claim | Successful operation |
400 | ErrorResponse | Structured API error |
401 | ErrorResponse | Missing or invalid credentials |
403 | ErrorResponse | Role or ownership denied |
404 | ErrorResponse | Resource unavailable to this identity |
409 | ErrorResponse | Revision, idempotency, immutable version or lease conflict |
413 | ErrorResponse | Structured API error |
422 | ErrorResponse | Capability input/output schema violation |
429 | ErrorResponse | Capacity exceeded |
500 | ErrorResponse | Structured API error |
503 | ErrorResponse | Structured API error |
Example response 200
{
"capacity": 0,
"draining": false,
"task": {
"attempt": 0,
"capability": "string",
"deadline_at": 0,
"emitter": {
"emitter_id": "string",
"event_id": "string",
"event_type": "string",
"idempotency_key": "string",
"managed_by": "string",
"received_at": "string",
"source": "string"
},
"id": "string",
"input": {},
"kind": "string",
"label": "string",
"lease_expires_at": 0,
"lease_token": "string",
"max_attempts": 0,
"namespace": "string",
"parent_id": "string",
"parent_step_id": "string",
"principal": "string",
"root_id": "string",
"session_id": "string",
"step_id": "string",
"target": "string",
"timeout_seconds": 0,
"version": "string"
}
}
completeTask
Provide exactly one of output or error. Stale, expired or cancelled leases conflict. Retryable errors are retried only within the registered max_attempts policy.
Request body
{
"id": "string",
"lease_token": "string",
"worker_id": "string"
}
Responses
| Status | Body | Meaning |
|---|---|---|
200 | Accepted | Successful operation |
400 | ErrorResponse | Structured API error |
401 | ErrorResponse | Missing or invalid credentials |
403 | ErrorResponse | Role or ownership denied |
404 | ErrorResponse | Resource unavailable to this identity |
409 | ErrorResponse | Revision, idempotency, immutable version or lease conflict |
413 | ErrorResponse | Structured API error |
422 | ErrorResponse | Capability input/output schema violation |
429 | ErrorResponse | Capacity exceeded |
500 | ErrorResponse | Structured API error |
503 | ErrorResponse | Structured API error |
Example response 200
{
"accepted": false
}
drainWorker
Request body
{
"worker_id": "string"
}
Responses
| Status | Body | Meaning |
|---|---|---|
200 | Draining | Successful operation |
400 | ErrorResponse | Structured API error |
401 | ErrorResponse | Missing or invalid credentials |
403 | ErrorResponse | Role or ownership denied |
404 | ErrorResponse | Resource unavailable to this identity |
409 | ErrorResponse | Revision, idempotency, immutable version or lease conflict |
413 | ErrorResponse | Structured API error |
422 | ErrorResponse | Capability input/output schema violation |
429 | ErrorResponse | Capacity exceeded |
500 | ErrorResponse | Structured API error |
503 | ErrorResponse | Structured API error |
Example response 200
{
"draining": false
}
enrollWorker
Request body
{
"label": "string",
"version": "string"
}
Responses
| Status | Body | Meaning |
|---|---|---|
201 | Worker | Successful operation |
400 | ErrorResponse | Structured API error |
401 | ErrorResponse | Missing or invalid credentials |
403 | ErrorResponse | Role or ownership denied |
404 | ErrorResponse | Resource unavailable to this identity |
409 | ErrorResponse | Revision, idempotency, immutable version or lease conflict |
413 | ErrorResponse | Structured API error |
422 | ErrorResponse | Capability input/output schema violation |
429 | ErrorResponse | Capacity exceeded |
500 | ErrorResponse | Structured API error |
503 | ErrorResponse | Structured API error |
Example response 201
{
"capacity": 0,
"label": "string",
"lease_seconds": 0,
"version": "string",
"worker_id": "string"
}
reportProgress
Request body
{
"data": {},
"id": "string",
"lease_token": "string",
"worker_id": "string"
}
Responses
| Status | Body | Meaning |
|---|---|---|
200 | Accepted | Successful operation |
400 | ErrorResponse | Structured API error |
401 | ErrorResponse | Missing or invalid credentials |
403 | ErrorResponse | Role or ownership denied |
404 | ErrorResponse | Resource unavailable to this identity |
409 | ErrorResponse | Revision, idempotency, immutable version or lease conflict |
413 | ErrorResponse | Structured API error |
422 | ErrorResponse | Capability input/output schema violation |
429 | ErrorResponse | Capacity exceeded |
500 | ErrorResponse | Structured API error |
503 | ErrorResponse | Structured API error |
Example response 200
{
"accepted": false
}
renewLease
Request body
{
"id": "string",
"lease_token": "string",
"worker_id": "string"
}
Responses
| Status | Body | Meaning |
|---|---|---|
200 | LeaseRenewal | Successful operation |
400 | ErrorResponse | Structured API error |
401 | ErrorResponse | Missing or invalid credentials |
403 | ErrorResponse | Role or ownership denied |
404 | ErrorResponse | Resource unavailable to this identity |
409 | ErrorResponse | Revision, idempotency, immutable version or lease conflict |
413 | ErrorResponse | Structured API error |
422 | ErrorResponse | Capability input/output schema violation |
429 | ErrorResponse | Capacity exceeded |
500 | ErrorResponse | Structured API error |
503 | ErrorResponse | Structured API error |
Example response 200
{
"cancel_requested": false,
"lease_expires_at": 0
}
resumeTask
Request body
{
"id": "string",
"lease_token": "string",
"worker_id": "string"
}
Responses
| Status | Body | Meaning |
|---|---|---|
200 | Resumed | Successful operation |
400 | ErrorResponse | Structured API error |
401 | ErrorResponse | Missing or invalid credentials |
403 | ErrorResponse | Role or ownership denied |
404 | ErrorResponse | Resource unavailable to this identity |
409 | ErrorResponse | Revision, idempotency, immutable version or lease conflict |
413 | ErrorResponse | Structured API error |
422 | ErrorResponse | Capability input/output schema violation |
429 | ErrorResponse | Capacity exceeded |
500 | ErrorResponse | Structured API error |
503 | ErrorResponse | Structured API error |
Example response 200
{
"resumed": false
}
suspendTask
Request body
{
"id": "string",
"lease_token": "string",
"worker_id": "string"
}
Responses
| Status | Body | Meaning |
|---|---|---|
200 | Suspended | Successful operation |
400 | ErrorResponse | Structured API error |
401 | ErrorResponse | Missing or invalid credentials |
403 | ErrorResponse | Role or ownership denied |
404 | ErrorResponse | Resource unavailable to this identity |
409 | ErrorResponse | Revision, idempotency, immutable version or lease conflict |
413 | ErrorResponse | Structured API error |
422 | ErrorResponse | Capability input/output schema violation |
429 | ErrorResponse | Capacity exceeded |
500 | ErrorResponse | Structured API error |
503 | ErrorResponse | Structured API error |
Example response 200
{
"suspended": false
}
listWorkers
Parameters
| Parameter | In | Required | Type |
|---|---|---|---|
label | query | no | string |
limit | query | no | integer |
Responses
| Status | Body | Meaning |
|---|---|---|
200 | WorkerList | Successful operation |
400 | ErrorResponse | Structured API error |
401 | ErrorResponse | Missing or invalid credentials |
403 | ErrorResponse | Role or ownership denied |
404 | ErrorResponse | Resource unavailable to this identity |
409 | ErrorResponse | Revision, idempotency, immutable version or lease conflict |
413 | ErrorResponse | Structured API error |
422 | ErrorResponse | Capability input/output schema violation |
429 | ErrorResponse | Capacity exceeded |
500 | ErrorResponse | Structured API error |
503 | ErrorResponse | Structured API error |
Example response 200
{
"items": [
{
"capacity": 0,
"draining": false,
"enrolled_at": 0,
"expired_leases": 0,
"id": "string",
"label": "string",
"last_seen_age_ms": 0,
"last_seen_at": 0,
"principal": "string",
"state": "string",
"tasks_in_flight": 0,
"version": "string"
}
],
"truncated": false
}