Location header
- Rule
- Identifies the primary created resource; if absent, the target URI is used
- Source
- RFC 9110
HTTP 201 means the request created one or more new resources. Learn what a correct 201 response includes, how it differs from 200, and how to return it.
HTTP 201 Created means the request was fulfilled and resulted in one or more new resources. The primary resource is identified by the Location header, or by the target URI if no Location is sent. Servers usually send it after a POST that creates something. It is a success, not an error.
Four quick questions, then a straight answer.
From your answers, this is quietly costing you traffic and nobody has the hours to chase it. Scaplet finds every affected page, drafts the fixes and tracks how AI answers mention you.
A data platform shipped 46 fixes without a ticket.
This looks handled. Re-check after a redesign, a migration or a big content push; that is when it breaks.
Your site is small and you have the time. Work through the steps on this page, starting with the pages that get the most traffic.
MDN says it is commonly sent as the result of a POST request, and that the new resource must be created before the response is returned. The new items can be returned in the body, but must be locatable by the URL of the initiating request or by the URL in the Location header.
RFC 9110 describes 202 as intentionally noncommittal: the request might or might not eventually be acted upon. Use 201 only when the resource exists at response time. If creation is queued, use 202 and describe the status in the body.
POST /users HTTP/1.1
Host: example.com
Content-Type: application/json
{ "firstName": "Brian", "lastName": "Smith" }
HTTP/1.1 201 Created
Content-Type: application/json
Location: http://example.com/users/123
{ "message": "New user created" }Save it before you respond. A 201 is a promise that the thing exists.
Point it at the new resource's URL, for example /users/123.
Include the created record or a link to it, as RFC 9110 suggests.
Send the POST with curl -i and confirm the status line, Location header and body.
4 questions people ask next, answered from the sources on this page.
It is not an error. It means the request succeeded and created one or more new resources.
A 200 means the request succeeded. A 201 means it succeeded and created a new resource, which is identified by the Location header or the target URI.
RFC 9110 says the content typically describes and links to the created resources, so include one. The Location header is the key part.
Return 201 when the POST created a resource. Return 200 when it returned the result of an action without creating one.
Run the free audit, then approve the fixes. Every change can be undone.