What 201 means
Typical response to a POST that creates something. The Location header usually points to the new resource.
Common causes
- A POST or PUT created a resource.
How to fix it
If you're calling an API
- Read the Location header or response body for the new resource's ID.
If you run the server
- Return the new resource (or its URL in Location) so clients don't need a second request.
Should you retry?
Don't retry: a retry may create a duplicate. Use idempotency keys where the API supports them.
Example response
HTTP/1.1 201 Created
Location: /v1/items/42
Content-Type: application/json
{"id": 42, "name": "New item"}Related headers: Location.
Defined in: RFC 9110 (HTTP Semantics). 201 is a success.