Run long-running document tasks asynchronously. Some document operations can take longer than a normal request/response cycle, especially for large files, multi-page PDFs, or consensus runs. Background mode lets the API accept the request, return a resource immediately, and continue the work after the client disconnects. To start a background run, passDocumentation Index
Fetch the complete documentation index at: https://docs.retab.com/llms.txt
Use this file to discover all available pages before exploring further.
background: true when creating a primitive
resource such as a parse, extraction, classification, split, partition, or edit.
The initial response includes an id and a lifecycle status; poll the
resource until it reaches a terminal state.
Create a background run
Setbackground to true on the create request. The response returns before
the output is ready, usually with status queued or pending.
Python
TypeScript
cURL
Poll a background run
Retrieve the resource by ID to check progress. Keep polling while the status ispending, queued, or in_progress. Once the status changes to completed,
failed, or cancelled, the run has reached a terminal state.
Python
TypeScript
cURL
Cancel a background run
You can cancel a run that has not reached a terminal state. Cancellation is idempotent for primitive resources: if the run already finished, Retab returns the current resource state.Python
TypeScript
cURL
Streaming and background mode
background and stream are mutually exclusive. Use streaming when you need
incremental events on a live connection. Use background mode when you want the
task to keep running even if the client closes the connection, then poll the
resource later.
Supported resources
The same pattern applies across primitives:| Resource | Create with background | Poll status | Cancel |
|---|---|---|---|
| Classifications | POST /v1/classifications | GET /v1/classifications/{classification_id} | POST /v1/classifications/{classification_id}/cancel |
| Extractions | POST /v1/extractions | GET /v1/extractions/{extraction_id} | POST /v1/extractions/{extraction_id}/cancel |
| Splits | POST /v1/splits | GET /v1/splits/{split_id} | POST /v1/splits/{split_id}/cancel |
| Partitions | POST /v1/partitions | GET /v1/partitions/{partition_id} | POST /v1/partitions/{partition_id}/cancel |
| Edits | POST /v1/edits | GET /v1/edits/{edit_id} | POST /v1/edits/{edit_id}/cancel |
| Parses | POST /v1/parses | GET /v1/parses/{parse_id} | POST /v1/parses/{parse_id}/cancel |
Limits
- Background runs return before the output is ready. Read
outputonly after the resource reachescompleted. - Background mode cannot be combined with streaming.
- Poll by resource ID. Do not depend on a long-lived HTTP connection for completion.
- Failed runs expose error details on the resource’s
errorfield.