202

Accepted

Overview

202 Accepted means the request has been accepted for processing but is not yet complete. The server uses it when it queues the request or hands it to an asynchronous worker and wants to respond immediately without waiting for the outcome.

Because success is not yet determined at response time, the server usually provides a status/job URL (via Location or the body) that the client can poll.

When it happens

Request / Response example

Request
POST /api/reports HTTP/1.1
Host: api.example.com
Content-Type: application/json

{"type":"monthly","month":"2026-07"}
Response
HTTP/1.1 202 Accepted
Location: /api/jobs/8f2a
Content-Type: application/json

{"jobId":"8f2a","status":"queued"}

In code

app.post('/api/reports', (req, res) => {
  const jobId = queue.enqueue(req.body);
  res.status(202).location(`/api/jobs/${jobId}`).json({ jobId, status: 'queued' });
});
@app.post('/api/reports')
def report():
    job = queue.enqueue(build_report, request.json)
    return {'jobId': job.id, 'status': 'queued'}, 202

Notes

Related status codes

Related headers

Specification