Overview
Every Aifano endpoint has an async variant (/parse_async, /extract_async, /split_async, /edit_async, /pipeline_async). Async endpoints return a job_id immediately, and you poll for results or receive them via webhook.
Use async processing when:
- Documents are large (50+ pages)
- You’re processing batches of documents
- You don’t need results immediately
- You want to avoid request timeouts
Submitting an Async Job
Add_async to any endpoint:
Response
Polling for Results
UseGET /job/{job_id} to check the status:
Job Statuses
| Status | Description |
|---|---|
PENDING | Job is queued and waiting to be processed |
RUNNING | Job is currently being processed |
COMPLETED | Job finished successfully — results are available |
FAILED | Job failed — check the error field for details |
Completed Job Response
Cancelling a Job
Cancel a running or pending job:Async Endpoints
| Sync Endpoint | Async Endpoint | Description |
|---|---|---|
POST /parse | POST /parse_async | Document parsing |
POST /extract | POST /extract_async | Data extraction |
POST /split | POST /split_async | Document splitting |
POST /edit | POST /edit_async | Document editing |
POST /pipeline | POST /pipeline_async | Pipeline execution |
Best Practices
Use reasonable polling intervals
Use reasonable polling intervals
Poll every 2–5 seconds. Avoid polling more frequently than once per second.
Set a polling timeout
Set a polling timeout
Set a maximum number of polling attempts (e.g., 150 attempts × 2s = 5 minutes) to avoid infinite loops.
Handle failures gracefully
Handle failures gracefully
Always check for
FAILED status and inspect the error field. Implement retry logic for transient errors.Use async for batch processing
Use async for batch processing
Submit all jobs first, then poll for results. This maximizes throughput and avoids sequential bottlenecks.