When you see this status
- POST request creates a new entity
- PUT request creates a new resource at a client-specified URI
- Successful resource creation in RESTful APIs
Common causes
- Client sends valid request with sufficient data
- Server processes request and creates new resource
- Resource did not exist prior to request
How to debug it
- Verify request payload is valid and complete
- Check server logs for creation errors
- Ensure resource URI is unique and not conflicting
- Confirm client has proper permissions
Return this code in your framework
Express (Node.js)
res.status(201).location('/users/123').json({ id: 123 });
FastAPI (Python)
return JSONResponse(status_code=201, headers={"Location": "/items/1"}, content={"id": 1});
NestJS
@Post() @HttpCode(201) async create(@Body() dto: CreateDto) { return { id: 1 }; }
Go (net/http)
w.WriteHeader(http.StatusCreated); w.Header().Set("Location", "/items/1");
About HTTP 201
HTTP status code 201 Created is part of the
2xx Success family. Resource successfully created; response includes URI of new resource. Understanding it is essential for
backend engineers, API designers, and anyone debugging integrations between services.
The Qaynaq Labs HTTP Status Code Explainer covers all standard codes with practical guidance:
what triggers them, how to debug them in production, and exactly how to return them from common
frameworks. Each code page is hand-curated and verified.