202 Accepted and a status resource
Some operations take minutes: generating a report, transcoding a video, importing a CSV. Holding the HTTP request open that long fails on timeouts in proxies and load balancers, and a retry would start the job twice.
Instead, accept the job and return 202 Accepted at once, with, by convention, a Location header pointing to a status resource: /exports/77. The client polls it (GET /exports/77) and sees status: queued → running → succeeded or failed. When it's done, the status resource links to the result. Tell clients how often to poll (commonly with a Retry-After header) so they don't hammer the server.
Cloud providers return an operation id for long jobs such as creating a database; the client polls the operation until it's done.
In code: HTTP
POST /exports
{"from": "2026-01-01", "to": "2026-09-30"}
→ 202 Accepted
Location: /exports/77
GET /exports/77
→ 200 OK
Retry-After: 10
{"id": "77", "status": "running", "progress": 0.4}
GET /exports/77
→ 200 OK
{"id": "77", "status": "succeeded", "result_url": "/exports/77/file"}- 202 means 'accepted for processing', not 'done': the job can still fail, and the status resource must say so.
- Combine with an idempotency key so a retried POST doesn't start a second export.
Generating a yearly report takes about 3 minutes. Which designs work? (Choose two.)
Select 2, then check.