What 201 means
The request worked and created one or more new resources. The Location header usually points to the new thing, and the body often describes it.
When servers send it
After a POST that creates something (a user, an order, an upload), or a PUT that creates a resource at a URL that didn’t exist before.
Why you might see it
- A successful create.
Using it as a developer
- Include a
Locationheader with the URL of the new resource. - Returning the created object in the body saves the client a second request.
- If the work happens later, use 202 Accepted instead: 201 means it already exists.
If you’re visiting a website
- Nothing. Something was created successfully.
Related codes
- 200 OK: The request worked and the response contains the result.
- 202 Accepted: The request has been accepted for processing later, but it hasn’t been done yet.
- 204 No Content: The request worked and there is nothing to send back.
- 409 Conflict: The request clashes with the current state of the resource, such as an edit conflict or a duplicate.
Where it’s defined
201 Created is defined in RFC 9110, section 15.3.2. It’s a 2xx code, the success class: the request worked.
Other 2xx codes
200 OK · 202 Accepted · 204 No Content · 206 Partial Content
Or search them all in the HTTP status code list.
Questions people ask
What does HTTP 201 Created mean?
Should POST return 200 or 201?
Location header is the clearer choice. If the POST ran an action that didn’t create a resource, 200 (or 204) fits better.