More
More
202 Accepted
The request was accepted for processing, but the work is not finished yet.
- Code
202- Reason phrase
- Accepted
- Class
- 2xx Success
- Defined in
- RFC 9110 section 15.3.3
- Cacheable by default
- No
What it means
Success: the request was received, understood and accepted.
When a server should send it. When the request is valid and queued but not done, so the server cannot yet say whether it will succeed. Give the client a way to follow up: a status URL in the body or a Location header, or a promise of a webhook.
Common causes. Queued jobs: video encoding, bulk imports, report generation.
What to do. Poll the status address the API gives you, or wait for its webhook.
How clients and crawlers treat it
Browsers and HTTP clients. Clients treat it as success. There is no built-in polling, so the client must check the status address the API gives.
Google Search. Googlebot waits a limited time for the content, then passes on whatever it received for indexing. Source: Google Search Central, How HTTP status codes, and network and DNS errors affect Google Search.
Caching. Not cacheable by default (RFC 9110 section 15.1 does not list it). A cache stores it only when the response says so with Cache-Control or Expires.
Example response
HTTP/1.1 202 Accepted
Location: /api/jobs/77/status
Content-Type: application/json
{"status": 202, "title": "Accepted"}
How to send 202
location /example {
return 202 'Accepted';
}
http_response_code(202); echo 'Accepted'; exit;
res.writeHead(202, { 'Content-Type': 'text/plain' });
res.end('Accepted');
# in a view function return 'Accepted', 202
Change the paths to suit. In nginx, add_header needs always to apply to error responses.
Related codes
- 201CreatedThe request succeeded and created something new, usually named in the Location header.
- 200OKThe request succeeded and the response carries the result.
- 303See OtherFetch the result from another address with GET.
All status codes · All 2xx codes
Names and numbers from the IANA HTTP Status Code Registry. Google Search behaviour as documented by Google Search Central.