Cancel an async job
Stop starting the job's requests. Requests already running finish and are charged; the rest end cancelled at no charge. A job that has not started ends cancelled at once; a running one answers cancelling until its in-flight requests finish.
Required permission
Requires the async.write permission. See Permissions for the roles and API key permissions that include it.
Command line
The orl CLI wraps this endpoint:
orl async job cancel <id>apiKeyAuthorizationBearer <token>OpenRelay API key. Send it as Authorization: Bearer or_… (legacy vl_… keys still work).
id*stringThe job, cancelled or cancelling.
application/json- response
An async job.
id*stringThe job id (ajob_...).
object*"async.job""async.job"completion_window*string"1h""24h"status*string"queued""running""cancelling""completed""cancelled""failed"created_at*integerUnix seconds.
int64started_at*integerWhen the first request began running; null until then.
int64completed_at*integerWhen the job ended; null while it is live.
int64deadline_at*integercreated_at plus the window. A request not started by then expires.
int64request_counts*A job's requests by outcome; total minus the outcomes have not finished.
usage*cost_nano_usd*integerBilled so far, in nanodollars (1e-9 USD).
int64input_file_id*stringThe job's input: the uploaded file, or the file its inline requests were stored as.
output_file_id*stringAlways null today: a finished job leaves no output file. Read the results from GET /v1/async/jobs/{id}/results.
error_file_id*stringAlways null today: a finished job leaves no error file. Read the failed results from GET /v1/async/jobs/{id}/results with status=failed.
metadata*rejected_count?integerOnly on the create answer, how many lines the create rejected.
int64rejected_records?array<>Only on the create answer, and only when the create rejected lines: the first 100 rejected lines, in input order.
items <= 100rejected_records_file_id?stringOnly on the create answer, and only when the create rejected lines: the file holding every rejected line.
curl -X POST 'https://inference.openrelay.inc/v1/async/jobs/string/cancel'{ "id": "string", "object": "async.job", "completion_window": "1h", "status": "queued", "created_at": 0, "started_at": 0, "completed_at": 0, "deadline_at": 0, "request_counts": { "total": 0, "completed": 0, "failed": 0, "expired": 0, "cancelled": 0 }, "usage": { "input_tokens": 0, "cached_input_tokens": 0, "output_tokens": 0 }, "cost_nano_usd": 0, "input_file_id": "string", "output_file_id": "string", "error_file_id": "string", "metadata": { "property1": "string", "property2": "string" }, "rejected_count": 0, "rejected_records": [ { "line": 0, "custom_id": "string", "code": "invalid_json", "message": "string" } ], "rejected_records_file_id": "string"}Get an async job GET
The job, its status, request counts, token usage and the cost billed so far, readable while it runs and after it ends.
Read an async job's results GET
Finished results so far, a page at a time, readable while the job runs: results arrive a group of requests at a time, as each group finishes. Groups show in order. A page reads at most 32 MB of results plus the one result that crosses that budget (a result is never split), and can end with none and has_more true; poll on with its next_cursor. has_more stays true while the job is live; poll with the same after. A cursor pages only the job and the status filter it was read under.