201 Created: confirming a new resource

201 Created confirms that a request succeeded and created a new resource, which the Location header usually identifies.

Check a URL’s status code

201 Created confirms that a request succeeded and created something new: an account, an order, an uploaded file, a record in an API. It’s a status for write operations, and the response should point to the new resource.

Definition

RFC 9110, section 15.3.2 says the request “has been fulfilled and has resulted in one or more new resources being created.” The main new resource is identified by the Location header or, if there’s none, by the request URL. The body typically describes the new resource and links to it. A 201 usually answers POST (create inside a collection) or PUT (create at a URL the client chose).

POST /api/v1/articles HTTP/1.1
Host: api.example.com
Content-Type: application/json

{"title":"HTTP status codes for SEO"}

HTTP/1.1 201 Created
Location: /api/v1/articles/4821
Content-Type: application/json

{"id":4821,"title":"HTTP status codes for SEO","status":"draft"}

If the work isn’t finished yet, 202 Accepted is more honest. If the resource already exists, consider 409 Conflict; if the input fails validation, 422 Unprocessable Content.

SEO impact

Pages meant for search should answer GET with 200 OK, not 201. Google’s documentation says that for 201 and 202, Googlebot waits for content for a limited time and then passes whatever it received to the indexing pipeline. So a page served with 201 may still be processed, but the status points to a routing or code mistake, for example a controller written for creating records being reused to render a public page. Fix it rather than relying on Google’s tolerance.

Developer tips

  • Always send Location with the URL of the new resource.
  • Return the created representation in the body to save the client a second request.
  • Make create endpoints safe to retry, for example with an idempotency key, so a repeated request doesn’t create duplicates.

How to check

Run public URLs through the HTTP status checker; anything other than 200 on an indexable page deserves a look. For API endpoints, curl with -i prints the status line and the Location header:

curl -i -X POST https://api.example.com/v1/articles \
  -H 'Content-Type: application/json' -d '{"title":"Draft"}'

Frequently asked questions

What is the difference between 200 and 201?

200 OK is a general success. 201 Created specifically says a new resource was created, and it usually includes a Location header with that resource’s URL.

Should a 201 response include a body?

It doesn’t have to, but it usually should: a description of the new resource or the resource itself, plus a link to it. That saves the client an extra request.

Can a web page return 201 to Googlebot?

It shouldn’t. Google says it waits a limited time for 201 content and then processes what it got, but public pages should return 200. A 201 on a GET request usually means a routing bug.