📋
202
Accepted

Example HTTP Response

HTTP Response
HTTP/1.1 202 Accepted
Content-Type: application/json

{"status": "queued", "jobId": "abc123"}
Common Causes
  • Batch processing job queued
  • Email scheduled for delivery
  • Async operation started
Technical Details

What does this mean?

Got it! Your request is in the queue. Like ordering at a busy restaurant — they've taken your order but your food isn't ready yet.

Technical Definition

The request has been accepted for processing, but the processing has not been completed.

RFC Says

"The 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."

Plain English:

202 means 'I've received your request and will process it later.' Use this for asynchronous operations like batch jobs, video encoding, or email sending. The response often includes a job ID or location where the client can check the status later.

Common Misinterpretation

202 doesn't guarantee the operation will succeed - just that it's been queued. Always provide a way for clients to check the operation status (via a job ID or status URL).

Code Snippets

Ready-to-use code for returning this HTTP status in your application:

Node.js
// Express.js
app.get('/example', (req, res) => {
  res.status(202).json({
    error: 'Accepted',
    message: 'Your error message here'
  });
});

// Native HTTP
const http = require('http');

http.createServer((req, res) => {
  res.writeHead(202, { 'Content-Type': 'application/json' });
  res.end(JSON.stringify({
    error: 'Accepted',
    message: 'Your error message here'
  }));
}).listen(3000);