DevToolPal
EN
2xx Success

201 Created

What it means

The request succeeded and created a new resource. The Location header usually points to it.

Common causes

  • POST to a collection created a record
  • PUT created a resource at a new URL

How to fix it

As a client or visitor

Read the Location header to get the new resource's URL, or use the returned body if the API includes the created object.

As the site or API owner

Include Location with the new URL and, ideally, the created representation. Do not return 201 when nothing was created; idempotent retries that find an existing item can return 200 or 409.

Example response

HTTP/1.1
HTTP/1.1 201 Created
Date: Tue, 07 Oct 2025 09:30:00 GMT
Server: nginx
Location: /users/42
Content-Type: application/json

{
  "id": 42,
  "name": "Ada"
}

Specification

RFC 9110 §15.3.2

FAQ

› Is the Location header required with 201?

It is strongly recommended. Without it, clients must guess the new URL from the body.

› What is the difference between 201 and 202?

201 means the resource already exists now. 202 means the request was accepted and will be processed later.