Created
Success (2xx)The 201 Created status code indicates that the request has been fulfilled and a new resource has been created. The response should include a Location header with the URI of the new resource and typically includes the created resource in the body. This is the standard response for successful POST requests that create new entities.
What is HTTP 201 Created?
HTTP 201 Created is a success (2xx) status code. The 201 Created status code indicates that the request has been fulfilled and a new resource has been created. The response should include a Location header with the URI of the new resource and typically includes the created resource in the body. This is the standard response for successful POST requests that create new entities. Common causes include successful post request creating a new resource and user registration completed. This response indicates the server processed the request as expected.
Example Response
HTTP/1.1 201 Created
Location: /api/users/42
Content-Type: application/json
{"id": 42, "name": "Jane"} Common Causes
- • Successful POST request creating a new resource
- • User registration completed
- • New record inserted in a database
- • File uploaded successfully
What to Know
- 1. 201 is a success status — no fix needed
- 2. If you receive 201 but no Location header, the API may not follow best practices
- 3. Check the response body for the newly created resource details
Frequently Asked Questions
Should 201 always include a Location header?
The HTTP spec recommends including a Location header pointing to the new resource's URI. While not strictly required, it is a best practice that helps clients navigate to or reference the created resource.
When should I use 201 vs 200?
Use 201 when a new resource was created (new user, new post, new order). Use 200 for other successful operations that do not create a new resource.
Can a PUT request return 201?
Yes. If a PUT request creates a new resource (because the target resource did not exist), 201 Created is appropriate. If PUT updates an existing resource, use 200 OK or 204 No Content.