202 Accepted

202 Accepted, means that the server accepted the request, but it’s not sure yet if the request will be completed successfully.

The specification calls it ‘intentionally non-committal’. You might see APIs using this response for for example asynchronous batch processing. HTTP doesn’t have a standard way to communicate after a request if a request eventually succeeded. An API using this might use some other facility to later to do this.

For example, it might send an email to a user telling them that the batch process worked, or it might expose another endpoint in the API that can indicates the current status of a long-running process.

Example

POST /my-batch-process HTTP/1.1
Content-Type: application/json

...
HTTP/1.1 202 Accepted
Link: </batch-status/5545> rel="http://example.org/batch-status"
Content-Length: 0

HTTP series

This article is part of an ongoing series about the HTTP protocol.

If you want to follow along as I write them, you can Subscribe to my Atom feed or Mailing list.

Informational 1xx

Successful 2xx

Redirection 3xx

Client Error 4xx

Web mentions