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

Usage notes

For clients

For servers

Examples

Creating a resource with POST

A POST that creates an order:

HTTP request

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}

The response reports where the new resource lives in the Location header:

HTTP response

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

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

Specifications

See also