Job resource. Every
job-creating route accepts ?wait_seconds= to optionally block for a result.
Job states
Every job flows through these states:Sync vs async via wait_seconds
The ?wait_seconds= query parameter controls blocking on each job-creating route:
- Python
- TypeScript
- cURL
- 200 — Job reached a terminal state within
wait_seconds; full result is inline. - 202 — Timeout before completion; poll
GET /v1/jobs/{job_id}.
wait_seconds accepts at most 300 seconds. For retained jobs, the deployment’s
NDI_MAX_INLINE_WAIT_SECONDS setting may end the wait earlier and answer 202
with the running job; poll GET /v1/jobs/{job_id} either way. Zero-retention jobs
are exempt from that deployment cap, except the jobs of a tenant that opted in to the
24 hour result hold, which are capped like retained jobs and can be polled instead.
wait_seconds is always a query parameter,
never a JSON body field.
Polling
- Python
- TypeScript
- cURL
Streaming job events
Subscribe to real-time status transitions instead of polling:- Python
- TypeScript
- cURL
text/event-stream (Server-Sent Events). Each event is a small status
update with sequence, at, status, and progress. It is not a full Job. The stream closes when the job reaches a terminal status.
Call GET /v1/jobs/{id} to read the full job, including its result or error.
Idempotency
Use theIdempotency-Key HTTP header to make job-creating requests replay-safe:
- Python
- TypeScript
- cURL
- First call — Starts a new job with
replayed: falseand noIdempotent-Replayedheader. - Repeated calls with the same key — Returns the original job with
replayed: trueand the response headerIdempotent-Replayed: true, without starting a new job or billing again.Job.creditsstill reports what the original job cost (ornulluntil its usage is final); do not add that amount to your spend again. A laterGETreportsreplayed: false: the flag describes the response to the submission, not persistent job state. - The key is scoped per API key.
- The key is kept with the job for replay and is never cleared, also after the job’s content is deleted (see Data retention). Do not put personal data in an idempotency key. Use an opaque value such as a UUID or a hash of your own request id.
Idempotency-Key is always an HTTP header, never a JSON body field.
Use for:
- Retrying after a network failure (the same job is returned)
- CI/CD pipelines (re-running a step is safe)
Workspace creation
POST /v1/workspaces also accepts Idempotency-Key. Both SDKs generate one
when omitted. The key is scoped to the API key, tenant and external account.
The same key and normalized body replay the original workspace. While an attempt
with the key is still running, a retry returns 503 storage_unavailable; retry
later with the same key and body rather than a new key. A changed body, a deleted
workspace or an attempt abandoned for longer than the cleanup window returns
409 storage_conflict. Keys survive deletion, so use opaque values without
personal data.
Listing jobs
- Python
- TypeScript
- cURL
?cursor=<next_cursor> to retrieve the next page. Optional filters: ?status=succeeded, ?kind=parse.
Cancellation
- Python
- TypeScript
- cURL
- Queued or running — Job is marked
cancelled. - Already terminal — Refused with
409job_not_cancellable. The job is unchanged; read it withGET /v1/jobs/{id}.
credits are 0, including labels or values already delivered by progressive classify or extract. A cancelled job returns no results. GET /v1/jobs/{id} still
returns the job, with result: null and result_state: "cancelled". That includes the
labels or values a progressive classify or extract published before you cancelled it.
For an automatic search, it also covers the job the search delegated to: reading that job by
its id returns no result either, even if it finished before the cancel. Reads that serve a
result, such as query result rows, grounding rows, QA presentations and filtered-search pages,
are refused with 409 job_cancelled. Results you received before the cancel stay with you.
No new download links are issued after the cancel. Signed links to customer-workspace document
artifacts also check cancellation when opened. Other links issued before the cancel work until they expire.