- Home
- Tools
- Developer Tools
- HTTP Status Codes
- 201 Created
201 Created
The request succeeded and made a new resource, such as a record added through an API. Its address is normally in the Location header.
- Class
- 2xx Successful. The request was received, understood and accepted.
- Defined in
- RFC 9110
What it looks like
HTTP/1.1 201 Created Location: /orders/1042 Content-Type: application/json
When a server sends it
After a POST that adds something to a collection, or a PUT to an address where nothing existed yet. The response usually carries a Location header with the address of the new resource, and often the resource itself in the body.
What to do with it
Read the Location header if you need the new address, for instance to fetch or change the resource later.
If you build an API: answer 201 only when the resource exists by the time you answer. If it will be made later, 202 Accepted is the honest code. A PUT that replaced something that was already there gets 200 or 204.
Not to be confused with
| 200 OK | The request worked, without a new resource as the result. |
|---|---|
| 202 Accepted | The request was accepted, and the work has not been done yet. |
All codes are on the list of HTTP status codes, which can be searched by number and by word.