What it means
The request succeeded and created one or more new resources. The Location header should point to the new resource, and the body usually describes it.
Why you're seeing it
- A
POSTto a collection, such as creating a user or an order. - A
PUTto a URL where nothing existed yet.
How to fix it
- Include
Locationso clients don't have to guess the new URL. - If the work isn't done yet, return
202 Acceptedinstead. - If you updated an existing resource, use
200or204.
Example response
HTTP/1.1 201 Created Location: /users/42 Content-Type: application/json {"id": 42, "name": "Ada"}