SEO Firm

What Is a 202 Status Code?

A 202 status code means the server has accepted the client’s request for processing, but the action has not been completed yet. This response is noncommittal, meaning the request may or may not succeed eventually. It’s used when operations are long-running, such as video rendering, batch updates, or queued jobs, and the server needs time to finish them asynchronously.

In modern web development and RESTful APIs, handling long-running or asynchronous tasks is essential. This is where the 202 status code, known as “Accepted”, comes into play.

The HTTP 202 Accepted status code tells the client:

“We’ve received your request and accepted it for processing, but we’re not done yet.”

Unlike synchronous operations (where the result is returned immediately), 202 allows the server to defer processing — ideal for cases like video processing, bulk uploads, or background jobs.

When Should You Use a 202 Status Code?

Use 202 Accepted when:

  • The server has received and validated the request

  • The task will be processed later, not immediately

  • You need to tell the client, “We’ve got it, but check back for the result”

Common scenarios:

  • Processing large file uploads

  • Scheduling background jobs or tasks

  • Running analytics or reports

  • Sending confirmation that a queued operation has started

  • What is a 101 Status Code?
  • What is a 102 Status Code?
  • What is a 200 Status Code?
  • What is a 201 Status Code?
  • What is a 202 Status Code?
  • What is a 208 Status Code?
  • See All Status Code

Real-World 202 Status Code Examples

Let’s break down a real-world API example that shows the 202 status code in action.

Example: Submitting a Background Job

 

Step 1: Client Sends Request

Client Sends Request

Step 2: Server Responds with 202 Accepted

Client Sends Request

Step 2: Server Responds with 202 Accepted

This tells the client:
✅ “We accepted your job request”
✅ “Check the status later at /api/v1/job-status/123”

Server Responds with 202 Accepted

Step 3: Client Checks Job

Step 4: Server Responds with Progress or Final Result

Real-World 202 Status Code Examples

202 vs. 200, 201, 204, 303 — What’s the Difference?

The 202 Accepted status code is used when a server has received a request but will process it later. It differs from 200, 201, 204, and 303, which handle synchronous responses, creation, no content, or redirects.

Status CodeMeaningWhen to Use
200 OKRequest succeeded, result includedFor immediate, successful responses with data (GET, POST, PUT).
201 CreatedNew resource createdWhen POST or PUT creates a new resource, often with a Location header pointing to it.
202 AcceptedRequest accepted, processing laterFor asynchronous tasks where the result is pending; provide status endpoint to check progress.
204 No ContentSuccess, no response bodyWhen action succeeds but no data is returned (e.g., successful DELETE).
303 See OtherRedirect to another URLTo guide the client to retrieve the resource or result from a different endpoint (e.g., polling).
Difference

Best Practices for Using 202 Status Code

To use the 202 Accepted status code effectively, follow these best practices:

  • Provide a status URL
    Include a Location header pointing to where the client can check progress.

  • Set clear expectations
    Let clients know how often they should poll or when to expect updates.

  • Use 202 only for async operations
    Avoid using 202 if the task completes immediately — use 200 or 201 instead.

  • Include job or process IDs
    Help clients track individual tasks by returning unique identifiers.

Common Mistakes to Avoid

❌ Returning 202 without offering a way to check progress.
❌ Using 202 when the operation finishes during the same request.
❌ Forgetting to document the async workflow for API consumers.
❌ Not handling errors or failed jobs in follow-up responses (return 4xx or 5xx if needed).

Frequently Asked Questions

What does the 202 status code mean?

The 202 Accepted status code means the server has received the request but will process it later. It’s used for asynchronous operations where the final result is not yet available, and the client may need to check back for updates or completion.

When should I use a 202 Accepted response?

Use a 202 Accepted response when handling long-running tasks like video processing, bulk data imports, or queued jobs. The server acknowledges receipt but delays processing, requiring the client to check the status later through a provided endpoint.

How does 202 differ from 200 or 201?

While 200 OK and 201 Created indicate immediate success and return results or new resources, 202 Accepted signals delayed processing. The server hasn’t completed the task yet, and the client needs to follow up for the final outcome.

How should a client check a 202 status?

After receiving a 202 Accepted, the client should use the status URL (usually provided in the Location header) to poll or query the server for updates. Once the server finishes processing, it should return a final result, typically with a 200 OK.

Scroll to Top