HTTP 201 Created
HTTP 201 Created means the request succeeded and a new resource was created as a result. It is the standard response to a POST (or PUT) that creates…
Quick answer
HTTP 201 Created means the request succeeded and a new resource was created as a result. It is the standard response to a POST (or PUT) that creates something, and it should include a Location header pointing to the new resource’s URL.
Last updated · Maintained by FreeAIToolz · How we test
What does HTTP 201 Created mean?
Use 201 when the server has actually created the resource before responding. If creation will happen later (a queued job), 202 Accepted is the correct code instead. The body usually contains the created resource or a link to it.
| Status code | 201 |
|---|---|
| Name | Created |
| Class | 2xx Success |
| Defined in | RFC 9110 §15.3.2 |
| Cacheable by default | No, unless Cache-Control says so |
| Safe to retry automatically? | Not applicable |
| Related headers | Location |
What causes HTTP 201?
- A successful POST or PUT that created a record.
How do I fix HTTP 201?
- Return a Location header with the new resource’s URL.
- Use 202 if the work is queued and not finished yet.
What should a client do after HTTP 201?
Read the Location header (and body) to get the new resource. Do not repeat the POST, or you may create a duplicate; use an idempotency key if the client might retry.
Does HTTP 201 affect SEO?
No SEO impact; 201 is for APIs and form handlers, not crawlable pages.
Example 201 response
HTTP/1.1 201 Created
Date: Mon, 01 Dec 2026 12:00:00 GMT
Location: /api/users/42
Content-Type: application/json
{"error":{"status":201,"message":"Created"}} How to return 201 Created in code
Express (Node.js)
res.status(201).json({ error: 'Created' }); Next.js route handler
return Response.json({ error: 'Created' }, { status: 201 }); FastAPI (Python)
return Response(status_code=201) PHP
http_response_code(201); Nginx
location = /example {
return 201;
} Other 2xx status codes
The request was received, understood and accepted.
Frequently asked questions
201 vs 200 for POST?
Should 201 return the created object?
Is 201 a client or server error?
Related
- 200 OK HTTP 200 OK means the request succeeded.
- 202 Accepted HTTP 202 Accepted means the server has accepted the request for processing but has not finished it.
- 409 Conflict HTTP 409 Conflict means the request conflicts with the current state of the resource.
- 303 See Other HTTP 303 See Other tells the client to fetch a different URL with a GET request.
- Open the HTTP Status Codes Reference → Free, no signup.