Blog
HTTP 202 Accepted: Give Long Jobs A Resource, Not A Promise
202 Accepted means the server accepted a request for processing. It does not mean the export finished, the payment settled, or the job will definitely succeed.
Return something the client can observe.
Create A Job Resource
HTTP/1.1 202 Accepted
Location: /jobs/8f3a
Retry-After: 3
The job representation can move through QUEUED, RUNNING, SUCCEEDED, FAILED, and perhaps CANCELLED. Include progress only when it is meaningful, not a random percentage animated for comfort.
Submission Still Needs Idempotency
A client can lose the 202 response and submit again. Use an idempotency key or client operation ID so one logical request creates one job.
Persist job state before returning. An in-memory future behind a durable-looking URL is fraud after restart.
Define Result And Expiry
On success, link the result or redirect to the created resource. On failure, return a stable problem representation. Document how long job status and result remain available.
Cancellation is a request, not time travel. A job may already have crossed an irreversible boundary. Expose CANCEL_REQUESTED or a conflict when immediate cancellation cannot be guaranteed.
Async APIs move waiting out of one connection. They do not remove workflow design.