Cancel a job
Cancel a queued or in-flight async job (e.g., inference generation). Use this to stop a doomed batch instead of waiting for every unit to fail individually.
Behaviour:
- A queued or delayed job is removed from the queue and will never run.
- An in-flight job receives a cooperative-cancellation signal: the worker
observes it at its next checkpoint and stops dispatching further work
(for inference generation, this means no further sessions are created).
Work already in progress when the signal is observed is NOT rolled back —
sessions that have already been created remain. Subsequent reads of
GET /jobs/{jobId}/statuswill surface the distinctcancelledstate. - The in-flight guarantee applies only to handlers that implement the
cooperative-cancellation checkpoint. Today that is inference generation;
other job types (e.g. trace imports) do not yet observe the cancel signal
and will run to completion even though the cancel call returns 200 and the
status read flips to
cancelled. Trace imports are short, so this is a deliberate Phase-1 trade-off rather than a correctness issue.
Tenant isolation: only users in the dispatching user’s organization may
cancel a job. Cross-tenant cancels return 404 (not 403) to avoid leaking
the existence of jobs in other organizations — matching GET /jobs/{jobId}/status.
Authorizations
API key authorization. Pass your API key in the Authorization header as a Bearer token. Both new (gsk_*) and legacy (gsk-) API keys are accepted, e.g. Authorization: Bearer gsk_... or Authorization: Bearer gsk-....
Path Parameters
The ID of the job to cancel