202 Accepted

Success - Request accepted, processing pending

HTTP 202 Accepted

What It Means

The HTTP 202 Accepted status code indicates that the request has been accepted for processing, but the processing has not been completed. The request might or might not eventually be acted upon, as it might be disallowed when processing actually takes place.

When to Use 202

  • Background jobs: Video encoding, report generation, data exports
  • Email sending: Queued for delivery but not yet sent
  • Batch operations: Processing large datasets asynchronously
  • Webhooks: Acknowledging receipt before processing

Example Response

HTTP/1.1 202 Accepted
Content-Type: application/json
Location: /jobs/abc123

{
  "job_id": "abc123",
  "status": "pending",
  "status_url": "/jobs/abc123",
  "estimated_completion": "2025-01-15T10:30:00Z"
}

Best Practices

  • Include a Location header pointing to a status endpoint
  • Return a job ID the client can use to check status
  • Provide an estimated completion time if possible
  • Consider webhooks for notifying when processing completes

Polling Pattern

# 1. Client submits job
POST /exports HTTP/1.1
→ 202 Accepted { "job_id": "abc123" }

# 2. Client polls for status
GET /jobs/abc123 HTTP/1.1
→ 200 OK { "status": "processing", "progress": 45 }

# 3. Eventually...
GET /jobs/abc123 HTTP/1.1
→ 200 OK { "status": "complete", "result_url": "/exports/abc123.csv" }

202 vs 200 vs 201

Code Use When
200 Request complete, returning result now
201 Resource created immediately
202 Request accepted, will process later

Frequently Asked Questions

What does HTTP 202 Accepted mean?
HTTP 202 Accepted indicates that the server has received and accepted the request for processing, but the processing has not been completed yet. Unlike 200 OK which means the operation is done, 202 means the work is queued or in progress and may or may not succeed when it eventually runs.
When should I use 202 instead of 200?
Use 202 when your API needs to perform work that takes significant time, such as video encoding, report generation, large data exports, or sending emails. Return 202 immediately with a job ID, then let the client poll for status or receive a webhook when the work completes.
What should a 202 response body contain?
A 202 response should include a job or task identifier, a URL where the client can check the status (often in the Location header too), the current status (e.g., 'pending' or 'processing'), and optionally an estimated completion time. This gives the client everything needed to track the async operation.
What is the polling pattern with 202 Accepted?
The polling pattern works as follows: (1) Client sends a request, receives 202 with a job ID and status URL. (2) Client periodically sends GET requests to the status URL. (3) Status endpoint returns progress updates. (4) When complete, it returns the result or a link to download the output.
Can a 202 response still fail later?
Yes. The 202 status only means the request was accepted for processing. The actual processing may fail later due to validation errors, resource constraints, or other issues. This is why providing a status endpoint is important, so clients can discover whether the async operation succeeded or failed.

Monitor your async APIs

UptimeSignal checks your API endpoints and tracks response patterns.

Start monitoring free →

Related Status Codes

More Resources