{ }HttpStatus.com

201 Created

The request succeeded and resulted in a new resource being created, typically referenced by a Location header.

Defined in RFC 9110 §15.3.2

What 201 means

HTTP 201 Created confirms that a request, almost always a POST or occasionally a PUT, resulted in one or more new resources coming into existence. The spec expects the server to include a Location header pointing at the primary resource that was created, so the client can immediately address it in follow-up requests without having to guess or parse an ID out of the body. The response body is optional but conventionally contains a representation of the newly created resource, letting the client see server-assigned fields like an ID, timestamps, or computed values in the same round trip that created them.

This status is central to REST API design: a POST to a collection endpoint such as /orders that succeeds in creating a new order should return 201 with Location: /orders/8842 and a JSON body describing that order, rather than 200 with the same information. Using 201 specifically, instead of a generic 200, lets clients, SDKs, and API gateways distinguish create operations from reads or updates purely from the status line, which matters for idempotency handling, retry logic, and audit logging that treats creation as a distinct event from other successful writes.

A common source of confusion is PUT: when a PUT request creates a resource at a client-specified URL that did not previously exist, 201 is the correct response, with 200 or 204 reserved for a PUT that updated an existing resource. Because PUT is defined to be idempotent, a server that supports upsert-style PUT needs to check for prior existence before choosing between these codes. Frameworks that generate 201 automatically for any successful insert can get this wrong if the same handler also serves updates to existing rows.

201 responses are not cached by shared caches under normal rules, since a create operation is not considered safe to reuse for a different request, though the created resource itself becomes cacheable on subsequent GETs like any other resource. API clients and SDK generators frequently key their generated model classes off whether an endpoint returns 201, so omitting the Location header or returning an inconsistent body shape on creation tends to break tooling downstream even when the status code itself is correct.

Common causes

  • A POST request to a collection endpoint successfully inserted a new record, such as a new user, order, or document.
  • A PUT request targeted a URL that did not previously exist and the server created a resource there.
  • A batch or bulk-create endpoint successfully created one primary resource, referenced in the Location header, along with related secondary resources.
  • An asynchronous job creation endpoint immediately created a job record even though the underlying work will complete later.
  • A framework's scaffolded create action returns 201 by convention for any successful insert, including edge cases where the semantics do not quite fit.

How to fix a 201

If you are the client (browser user or API caller)

  • Read the Location header after a create request and use it as the canonical URL for the new resource instead of constructing one manually.
  • Parse the response body for server-generated fields, such as an ID or timestamp, rather than assuming the values you sent are exactly what got stored.
  • Treat 201 as distinct from 200 in client code so retries and idempotency keys are applied consistently to create operations.
  • Do not resend the same create request on a timeout without an idempotency key, since a lost 201 response can otherwise result in duplicate resources.

If you run the server

  • Always include a Location header pointing at the newly created resource's canonical URL when returning 201.
  • Return a representation of the created resource in the body so the client learns server-assigned fields without an extra GET.
  • Distinguish PUT requests that create a new resource, which should return 201, from those that update an existing one, which should return 200 or 204.
  • Support an idempotency key or similar mechanism on create endpoints so retried requests do not produce duplicate 201 responses for the same logical operation.
  • Avoid returning 201 for operations that only queue work asynchronously without yet creating a durable resource; use 202 Accepted for those instead.

Example

POST /api/orders HTTP/1.1
Host: api.example.com
Content-Type: application/json

{
  "sku": "WIDGET-12",
  "quantity": 3
}

HTTP/1.1 201 Created
Location: /api/orders/8842
Content-Type: application/json

{
  "id": 8842,
  "sku": "WIDGET-12",
  "quantity": 3,
  "status": "pending",
  "createdAt": "2026-09-04T12:00:00Z"
}
A POST to a collection endpoint creates a new order and returns its canonical URL.

Try it live

Our free status responder returns a real HTTP 201 you can point tests, monitors or a browser at.

GET https://mcp.httpstatus.com/status/201

Related status codes

Tools for debugging this