Why Use the Jobs API?
The Jobs API provides several advantages over synchronous requests:- Avoid request timeouts: Process large documents that would exceed HTTP timeout limits
- Resilient to disconnections: Jobs continue processing even if your client disconnects
- Higher throughput: Queue multiple jobs without waiting for each to complete
- 7-day result retention: Retrieve results anytime within the retention window
- Progress tracking: Monitor job status and get detailed error information
Getting Started
This guide walks you through creating a job, polling for completion, and retrieving results.1. Prepare Your Request
Before creating a job, prepare your document and any required parameters. Documents can be provided as base64-encoded data URLs:2. Create the Job
Submit your job by specifying the target endpoint and the request body:3. Check Job Status
Poll the job until it reaches a terminal status:4. Retrieve Results
Once the job completes, access the results from theresponse field:
5. Cancel a Job (Optional)
Cancel a job that is queued or in progress:6. List Jobs
View all your jobs with optional filtering:Complete Examples
Extract Structured Data
Extract structured data from documents using a JSON schema:Parse Document to Text
Convert documents to text or markdown format:Classify Documents
Classify documents into predefined categories:Supported Endpoints
The Jobs API supports the following endpoints:| Endpoint | Description |
|---|---|
/v1/documents/extract | Extract structured data from documents |
/v1/documents/parse | Parse documents to text/markdown |
/v1/documents/split | Split multi-page documents |
/v1/documents/classify | Classify documents into categories |
/v1/schemas/generate | Generate JSON schemas from documents |
/v1/edit/agent/fill | Fill form fields using AI agent |
/v1/edit/templates/fill | Fill templates with data |
/v1/edit/templates/generate | Generate form schemas from PDFs |
/v1/projects/extract | Extract using a project configuration |
Job Lifecycle
Jobs progress through the following statuses:| Status | Description |
|---|---|
validating | The request is being validated before the job can begin |
queued | Job is waiting in the processing queue |
in_progress | Job is currently being processed by the executor |
completed | Job finished successfully, results available in response |
failed | Job execution failed, see error field for details |
cancelled | Job was cancelled by user request |
expired | Job data expired (7 days after creation) |
Rate Limits and Constraints
The Jobs API has the following limits:| Constraint | Limit |
|---|---|
| Metadata key-value pairs | 16 maximum |
| Metadata key length | 64 characters |
| Metadata value length | 512 characters |
| Concurrent jobs | Unlimited |
| Result retention | 7 days |
Job Expiration
Jobs and their associated data expire 7 days after creation:- Both the
requestandresponsedata are deleted at expiration - The job record remains but with
status: "expired"and empty request/response - Check the
expires_attimestamp on the job object to know when data will be deleted - Retrieve and store results before expiration if you need long-term retention
Job Response Structure
When a job completes successfully, the result is available in theresponse field:
Error Handling
When a job fails, theerror field contains details about what went wrong:
Best Practices
Polling Strategy
- Use reasonable poll intervals (2-5 seconds) to balance responsiveness and API usage
- Set timeouts to avoid indefinite waiting for stuck jobs
- Use the
wait_for_completionhelper method when possible
Using Metadata
Use themetadata field to attach context to jobs for tracking and filtering:
- Tracking jobs by batch or source system
- Debugging failed jobs
- Filtering jobs when listing