Asynchronous Processing
For large documents or production workflows, use async processing to avoid timeouts and handle long-running operations gracefully.How It Works
- Submit - Send your request with
async: true - Receive job ID - Get an immediate response with a
job_id - Poll - Check job status via
GET /job/{jobId} - Get results - Retrieve completed results from the poll response
Endpoints with Async Support
| Endpoint | Async Flag | Async Response |
|---|---|---|
POST /extract | async: true | 202 with job_id |
POST /split | async: true | 202 with job_id |
POST /schema | async: true | 202 with job_id |
POST /extract_async is deprecated. Use POST /extract with async: true instead.Using the Async Flag
Addasync: true to any supported endpoint’s request body:
Async Response Format
Whenasync: true, you receive a 202 Accepted response:
| Field | Type | Description |
|---|---|---|
job_id | string | Unique identifier for the async job |
status | string | Initial status: pending or processing |
Polling for Results
UseGET /job/{jobId} to check status and retrieve results:
Poll Response
Job Status Values
| Status | Description |
|---|---|
pending | Job is queued, waiting to start |
processing | Job is currently running |
completed | Job finished successfully - results available |
failed | Job encountered an error |
canceled | Job was canceled by user |
Canceling Jobs
Cancel a running job withDELETE /job/{jobId}:
When to Use Async
Large documents (50+ pages)
Large documents (50+ pages)
Synchronous requests may timeout for large documents. Always use async for documents over 50 pages.
Complex schemas
Complex schemas
Schema extraction with many fields or nested structures benefits from async processing.
Production workflows
Production workflows
Async provides better reliability and allows you to handle failures gracefully with retries.
Batch processing
Batch processing
Submit multiple documents asynchronously and poll for results in parallel.
Sync vs Async Comparison
| Aspect | Sync (async: false) | Async (async: true) |
|---|---|---|
| Response | Full result | Job ID only |
| HTTP Status | 200 | 202 |
| Timeout risk | Higher | Lower |
| Best for | Small docs, testing | Production, large docs |
| Polling needed | No | Yes |
