DevKits
201

Created

2xx Success

Last updated:

A new resource has been created as a result of the request. The URI of the new resource is in the Location header.

Description

The standard response for a successful POST that creates a resource. The Location header must point at the new resource's canonical URI. The response body typically contains the created resource.

When to use

Return 201 after a POST or PUT that creates a new resource. Always include the Location header.

Common pitfalls

Returning 200 for a POST-that-creates hides useful information from clients and prevents Location-based navigation.

Specification

RFC 9110 §15.3.2

Examples

HTTP response
HTTP/1.1 201 Created
Content-Type: application/json

{"ok":true}
Node.js (Express)
res.status(201).json({ error: "Created" });
Go (net/http)
w.WriteHeader(http.StatusCreated)
Python (Flask)
return jsonify({"error": "Created"}), 201

Related status codes

All 2xx codes