Skip to content

Jobs — API reference

View as Markdown

Asking for work and finding out how it went.

GET /v1/jobs

List jobs

Parameters
NameInRequirementDescription
limitqueryOptionalPage size.
starting_afterqueryOptionalCursor from the previous page’s next_cursor.
statequeryOptionalFilter by job state.
project_idqueryOptionalFilter by project.
Responses
StatusDescription
200A page of jobs, newest first.
400Codes: invalid_request, unsupported_file, file_too_large, corrupted_file, encrypted_file, unsupported_operation.
401Codes: missing_credentials, invalid_api_key, expired_api_key, revoked_api_key, api_key_in_query.
403Codes: insufficient_scope, ip_not_allowed, environment_mismatch, organization_suspended, forbidden, key_restricted.
429Rate limited or out of credits. Retry after the interval in Retry-After. Codes: key_spend_limit, rate_limited, concurrency_limit, credits_exhausted.
500Codes: internal_error.
503Codes: processing_unavailable, dependency_unavailable.
504Codes: timeout.

POST /v1/jobs

Accepts the work and returns immediately with 202. Credits are reserved atomically at this point — a job that would exceed the balance is refused here rather than discovered on an invoice. Supply exactly one of operation or preset.

Parameters
NameInRequirementDescription
Idempotency-KeyheaderRequiredClient-generated key, scoped to (organization, endpoint) and retained 24 hours. A replay with the same body returns the stored response without re-executing or re-billing; a replay with a different body returns 409.
Request body
FieldTypeRequirementDescription
file_idstringRequiredThe file to process.
operationstringOptional
presetai-ready · document · image · avatar · inspectOptional
optionsobjectOptionalOperation-specific parameters.
Responses
StatusDescription
202Accepted. The job is queued; subscribe to a webhook or poll GET /v1/jobs/{job_id}.
400Codes: invalid_request, unsupported_file, file_too_large, corrupted_file, encrypted_file, unsupported_operation.
401Codes: missing_credentials, invalid_api_key, expired_api_key, revoked_api_key, api_key_in_query.
403Codes: insufficient_scope, ip_not_allowed, environment_mismatch, organization_suspended, forbidden, key_restricted.
404Not found. A resource belonging to another organization returns 404, never 403 — a 403 would confirm it exists. Codes: not_found.
409Codes: idempotency_conflict, upload_session_consumed, conflict.
422Codes: malware_detected, policy_violation, validation_failed, output_validation_failed, unsupported_input.
429Rate limited or out of credits. Retry after the interval in Retry-After. Codes: key_spend_limit, rate_limited, concurrency_limit, credits_exhausted.
500Codes: internal_error.
503Codes: processing_unavailable, dependency_unavailable.
504Codes: timeout.

GET /v1/jobs/{job_id}

Retrieve a job

Parameters
NameInRequirementDescription
job_idpathRequiredJob identifier.
Responses
StatusDescription
200The job.
401Codes: missing_credentials, invalid_api_key, expired_api_key, revoked_api_key, api_key_in_query.
403Codes: insufficient_scope, ip_not_allowed, environment_mismatch, organization_suspended, forbidden, key_restricted.
404Not found. A resource belonging to another organization returns 404, never 403 — a 403 would confirm it exists. Codes: not_found.
429Rate limited or out of credits. Retry after the interval in Retry-After. Codes: key_spend_limit, rate_limited, concurrency_limit, credits_exhausted.
500Codes: internal_error.
503Codes: processing_unavailable, dependency_unavailable.
504Codes: timeout.

POST /v1/batches

One operation across up to 100 files, accepted atomically: every member is admitted and priced in a single transaction, or the batch does not exist. Members are then ordinary jobs — same queues, same retries, same webhooks, same settlement — and a member that fails is a per-item error, charged nothing, while the rest proceed.

Parameters
NameInRequirementDescription
Idempotency-KeyheaderRequiredClient-generated key, scoped to (organization, endpoint) and retained 24 hours. A replay with the same body returns the stored response without re-executing or re-billing; a replay with a different body returns 409.
Request body
FieldTypeRequirementDescription
file_idsarray of stringRequired
operationstringOptional
presetai-ready · document · image · avatar · inspectOptional
optionsobjectOptionalOperation-specific parameters, applied to every member.
Responses
StatusDescription
202Accepted. Every member is queued; poll GET /v1/batches/{batch_id} or subscribe to job webhooks.
400Codes: invalid_request, unsupported_file, file_too_large, corrupted_file, encrypted_file, unsupported_operation.
401Codes: missing_credentials, invalid_api_key, expired_api_key, revoked_api_key, api_key_in_query.
403Codes: insufficient_scope, ip_not_allowed, environment_mismatch, organization_suspended, forbidden, key_restricted.
404Not found. A resource belonging to another organization returns 404, never 403 — a 403 would confirm it exists. Codes: not_found.
422Codes: malware_detected, policy_violation, validation_failed, output_validation_failed, unsupported_input.
429Rate limited or out of credits. Retry after the interval in Retry-After. Codes: key_spend_limit, rate_limited, concurrency_limit, credits_exhausted.
500Codes: internal_error.
503Codes: processing_unavailable, dependency_unavailable.
504Codes: timeout.

GET /v1/batches/{batch_id}

Aggregated state counts, credits estimated and charged, and the per-item outcomes. state is completed once every member is terminal — individual failures are items, not a batch failure.

Parameters
NameInRequirementDescription
batch_idpathRequiredBatch identifier.
Responses
StatusDescription
200The batch and its members.
401Codes: missing_credentials, invalid_api_key, expired_api_key, revoked_api_key, api_key_in_query.
403Codes: insufficient_scope, ip_not_allowed, environment_mismatch, organization_suspended, forbidden, key_restricted.
404Not found. A resource belonging to another organization returns 404, never 403 — a 403 would confirm it exists. Codes: not_found.
429Rate limited or out of credits. Retry after the interval in Retry-After. Codes: key_spend_limit, rate_limited, concurrency_limit, credits_exhausted.
500Codes: internal_error.
503Codes: processing_unavailable, dependency_unavailable.
504Codes: timeout.

POST /v1/jobs/{job_id}/cancel

Only queued work can be reclaimed. A job the worker already claimed keeps running — compute cannot be un-spent — and answers 409 with its state. Subscribers hear job.cancelled.

Parameters
NameInRequirementDescription
job_idpathRequiredJob identifier.
Idempotency-KeyheaderRequiredClient-generated key, scoped to (organization, endpoint) and retained 24 hours. A replay with the same body returns the stored response without re-executing or re-billing; a replay with a different body returns 409.
Responses
StatusDescription
200Cancelled.
401Codes: missing_credentials, invalid_api_key, expired_api_key, revoked_api_key, api_key_in_query.
403Codes: insufficient_scope, ip_not_allowed, environment_mismatch, organization_suspended, forbidden, key_restricted.
404Not found. A resource belonging to another organization returns 404, never 403 — a 403 would confirm it exists. Codes: not_found.
409Codes: idempotency_conflict, upload_session_consumed, conflict.
429Rate limited or out of credits. Retry after the interval in Retry-After. Codes: key_spend_limit, rate_limited, concurrency_limit, credits_exhausted.
500Codes: internal_error.
503Codes: processing_unavailable, dependency_unavailable.
504Codes: timeout.