201 Created
Success plus creation: the request succeeded and one or more new resources were created. A Location header should point to the new resource.
What it means
201 Created is returned when a POST or PUT results in a new resource. The response should include a Location header with the URL of the created resource, and typically a body representing it.
HTTP RESPONSE
HTTP/1.1 201 Created
Location: /api/orders/8842
Content-Type: application/json
{ "id": 8842, "status": "pending" }Why it matters
- It gives REST clients a precise signal that creation happened and, via Location, where the new resource lives.
- It distinguishes creation from a plain 200 update, improving API self-documentation.
Common mistakes
- Returning 200 instead of 201 after creating a resource, losing the semantic distinction.
- Omitting the Location header, forcing clients to guess the new resource's URL.
How WebInspect checks this
- In the API Inspector, WebInspect flags status-code correctness for write methods, including whether 201 carries a Location header.