Success · 2xx

201 Created

The request succeeded and a new resource was created as a result.

What 201 Created means

201 Created indicates that a POST or PUT request resulted in the creation of a new resource. The response should include a Location header pointing at the new resource's URL, and typically includes the resource representation in the body. 201 is more informative than 200 for creation operations because it tells API consumers "this is a new thing" rather than just "your request worked".

When servers should return it: Servers should return 201 (not 200) when a POST or PUT request creates a new addressable resource. Always include a Location header with the new URL.

Example response

curl -i -X POST https://api.example.com/users \
  -H "Content-Type: application/json" \
  -d '{"name":"Ada"}'

HTTP/2 201
location: /users/42
content-type: application/json
{"id":42,"name":"Ada","created_at":"2026-05-05T14:00:00Z"}

Related status codes

Frequently Asked Questions

Should the Location header be absolute or relative?
Either works. Absolute URLs are clearer for clients that follow redirects across hosts. Relative URLs are common in single-domain APIs.
Is 201 only for POST?
No. PUT can return 201 if it created a new resource (versus 200 if it replaced an existing one). PATCH usually returns 200.
Can 201 have an empty body?
Yes, technically. But returning the new resource representation is more useful so the client does not need to make a follow-up GET.
Defined in: RFC 9110 · Class: 2xx Success

More references

For a one-page reference of all HTTP status codes, see the HTTP cheat sheet. For testing API responses, try the API Tester tool. For inspecting responses on the command line, the curl cheat sheet covers the most common flags.