HTTP 201 Created: What It Means and When You See It
Quick Answer
HTTP 201 Created means the request succeeded and a new resource was created as a result. The Location header typically points to the new resource URL.
When APIs Return HTTP 201
HTTP 201 is the correct response for successful POST requests that create a new resource. It signals to the client that the resource was created and optionally where to find it. The response should include a Location header pointing to the new resource: Location: /api/users/12345. The response body typically contains the created resource including its server-assigned ID and computed fields (createdAt, updatedAt). Using 201 instead of 200 for creation is a REST best practice - it distinguishes creation from other successful operations and enables client-side caching and history management. PUT requests that create a resource (upsert) may also return 201.
201 vs 200 vs 204
HTTP 200 OK is for successful reads (GET) or updates where you return the modified resource. HTTP 201 Created is for successful creation (POST) with a body containing the new resource. HTTP 204 No Content is for successful operations with no body - typically DELETE or PUT when you do not return the updated resource. Returning 200 for a POST that creates a resource is not incorrect, but 201 is more precise and lets API clients distinguish creation from other successes. GraphQL APIs always return 200 regardless of operation type; REST APIs should use 201 for resource creation.
HTTP 201 in Code
Express.js: app.post("/users", async (req, res) => { const user = await db.users.create(req.body); res.status(201).location("/users/" + user.id).json(user); }). FastAPI (Python): return JSONResponse(content=user.dict(), status_code=201, headers={"Location": f"/users/{user.id}"}). curl: curl -X POST -H "Content-Type: application/json" -d '{"name":"Alice"}' https://api.example.com/users - check the response headers for the Location field. If your API consistently returns 200 for all success cases, consider adopting 201 for POST endpoints that create persistent resources.
Try the interactive tool
Convert any value instantly — no sign-up required
Frequently Asked Questions
Related Values
100
HTTP 100 Continue means the server has received the request headers and the client should proceed to send the request body. It is an interim response used to inform the client to continue.
101
HTTP 101 Switching Protocols indicates the server is switching to the protocol specified in the Upgrade header field. Commonly used when upgrading to WebSocket connections.
200
HTTP 200 OK is the standard success response. The request has succeeded and the server has returned the requested resource in the response body.
204
HTTP 204 No Content means the server successfully processed the request but is not returning any content. Common for DELETE requests or form submissions.