What does HTTP status code 202 mean?
The 202 Accepted status code indicates that the request has been received and validated, but the actual execution is being handled asynchronously (e.g., in a background queue).
When to use it in APIs
Use 202 for long-running processes (like generating a heavy PDF report, batch updates, or provisioning servers) to avoid holding the HTTP connection open. Often returns a link in the response body or a Location header to poll for the job status.
How it compares to other codes
- 201 Created: Reserves for synchronous, immediate resource creation.
- 200 OK: Reserves for synchronous request completion.