Qaynaq LABS · TOOLS

HTTP · 2xx Success

201 Created

Resource successfully created; response includes URI of new resource.

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

  1. Verify request payload is valid and complete
  2. Check server logs for creation errors
  3. Ensure resource URI is unique and not conflicting
  4. 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.

Frequently asked

Must a 201 response include a Location header?

Yes. RFC 9110 requires the Location header to specify the URI of the created resource.

Can 201 be used for non-resource creation?

Technically yes, but it's semantically incorrect. Use 200 or 204 instead.

Is 201 idempotent?

No. Repeating a 201-triggering request may create duplicate resources.