HTTP 202 Accepted

The request was accepted but has not been carried out yet. The work happens asynchronously, and the response tells you where to look for the result.

Defined in RFC 9110 §15.3.3 — 202 Accepted · MDN reference

Where you meet HTTP 202 in production

Report generation, video transcoding, bulk imports, index rebuilds and payment captures that clear asynchronously — anywhere the real work outlives the request that asked for it and the server refuses to hold the connection open.

Why you would test it

The status your client is most likely to mishandle: it is a success, but the thing you asked for has not happened. Poll the status URL until it resolves instead of assuming completion.

What your client should do about a 202

Treat it as "not yet", never as "done". Take the Location or the job id, poll with backoff, and give the poll a deadline. The most expensive bug in this shape is a test suite that asserts 202 and then asserts on data the job had not written yet — it passes locally and fails in CI, intermittently, forever.

202 versus the codes it gets confused with

Endpoints that return 202

4 endpoints in this playground answer with 202. Every one is free, needs no signup, and can be called from the browser or with curl.

Questions about HTTP 202

How do I know when the job is finished?
Poll the status URL the 202 gave you until it reports a terminal state. A well-designed API tells you a suggested interval; if it does not, back off exponentially.
What if the job fails?
The polling endpoint reports the failure — the 202 itself was correct, because the request to start the work really was accepted.

Other success codes

All HTTP status codes · All 39 mock REST APIs · Getting started guide

Last updated