201 Created

The request succeeded and created one or more new resources, identified by the Location header.

Status

HTTP/1.1 201 Created

Details

201 is the correct answer to a POST or PUT that brought a resource into existence. The Location header carries the URL of what was created. If more than one resource was created, Location points at the primary one and the body describes the rest.

The response should also carry validators for the new resource, so a client can immediately make conditional requests against it without a second round trip.

Headers

Common causes

How to fix it

As the client

As the server

Examples

POST /api/v2/order HTTP/1.1
Host: api.example.com
Authorization: Bearer sk_live_example
Content-Type: application/json

{"product_id":"isp-us","quantity":10}

HTTP/1.1 201 Created
Location: /api/v2/order/40213
Content-Type: application/json; charset=utf-8

{"id":40213,"status":"provisioning","quantity":10}

Specifications

RFC 9110 §15.3.2

See also