HTTP

Which HTTP Success Code Should I Return?

Not all successful responses should return 200 OK. This tree guides you to the most precise 2xx code based on what action was taken: creating a resource, accepting work asynchronously, returning no body, or sending partial content.

Decision Steps

Did this request create a new resource?

Has the request been accepted for processing but the work is not yet complete (asynchronous / queued job)?

Are you returning a response body with content?

Are you returning only part of the resource in response to a Range request?

Possible Outcomes

200-ok Request succeeded with response body
201-created New resource was created
202-accepted Accepted for async processing
204-no-content Success with no response body
206-partial-content Partial content returned via Range

Related Status Codes

Related Terms