HTTP Status Codes / 2xx HTTP Status Codes / HTTP 201

201 Created

This is an educational reference page about HTTP 201 Created. The page itself is served as 200 OK so it can be indexed as HTTP documentation.

The request succeeded and created one or more new resources. The Location header identifies the primary new resource.

Specification

Registered in the IANA HTTP Status Code Registry as Created. Defined in RFC 9110, Section 15.3.2.

What it means

HTTP 201 Created means the server fulfilled the request and created at least one new resource. The Location header points to the primary resource that was created. If there is no Location header, the new resource is the request's target URI, which is what happens with a successful PUT to a new URL.

When to use it

Headers involved

Examples

JSON API: POST creates a resource

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

{
  "content": "Read about status codes",
  "important": true
}

HTTP/1.1 201 Created
Location: /api/notes/42
Content-Type: application/json

{
  "id": "42",
  "content": "Read about status codes",
  "important": true
}

PUT to a new URL

PUT /files/report-2026.csv HTTP/1.1
Host: storage.example.com
Content-Type: text/csv

month,total
Jan,120

HTTP/1.1 201 Created
ETag: "e2c4"
Content-Length: 0

Common mistakes

Developer notes

A browser form POST usually ends with a redirect: the server answers 303 See Other or 302 Found and the browser loads a new page. A JavaScript app that sends JSON with fetch() wants 201 instead, because it stays on the same page, reads the new resource from the response body, and updates the UI without another request.

Questions

What does HTTP 201 Created mean?

HTTP 201 means the request succeeded and created a new resource. The Location header, if present, tells the client the URL of that resource.

Is a Location header required with 201?

For POST, RFC 9110 says the server SHOULD send Location for the primary resource created. Without Location, the client treats the request URL as the new resource, which fits a PUT to a new URL.

Should 201 include a response body?

It can. The body usually describes and links to the new resource. Many APIs return the created object so the client does not need a follow-up GET.

What is the difference between 201 and 202?

201 means the resource exists now. 202 means the server accepted the request but has not finished processing it, so the resource may not exist yet.

See also

Header and content rules

What RFC 9110 says about a 201 response, quoted from the RFC.

The same rules are in the response obligations table and its JSON.

2xx successful – the request was successfully received, understood, and accepted


HTTP status code lookup
REST API status code chooser
cURL command generator
By Ping Now, a website/API/service uptime monitor
Data from Wikipedia