📚 Quick Definition

The request has been fulfilled and has resulted in one or more new resources being created. The newly created resource's URI is returned in the Location header. This is the appropriate response for POST requests that create new records, user registrations, file uploads, and similar operations.

When It Occurs

A 201 Created response is returned when the server successfully processes a request that results in the creation of a new resource. This typically happens with POST requests (e.g., submitting a form that creates a new user account) or PUT requests that create a resource at a specified URI that did not previously exist.

🛠 Common Use Cases

  • POST request creating a new record in a database
  • User registration or account creation
  • File upload completed successfully
  • API creating a new resource (e.g., new order, new comment)
  • PUT creating a resource at a specified URI that did not exist

Best Practices

  • Return a Location header with the URI of the newly created resource
  • Include the created resource in the response body so clients don't need an extra GET request
  • Use 201 for POST and PUT requests that create new resources - not for updates
  • Don't use 201 for updates to existing resources - use 200 instead
  • Consider returning the resource ID and any server-generated fields (timestamps, UUIDs)

📡 HTTP Example

Request
POST /api/users HTTP/1.1
Host: api.example.com
Content-Type: application/json

{
  "name": "Jane Doe",
  "email": "jane@example.com"
}
Response
HTTP/1.1 201 Created
Content-Type: application/json
Location: /api/users/456

{
  "id": 456,
  "name": "Jane Doe",
  "email": "jane@example.com",
  "created_at": "2026-02-20T10:30:00Z"
}

Frequently Asked Questions

Should 201 include a response body? +
It is recommended to include a response body with the 201 Created status. Returning the created resource in the body saves the client from making an additional GET request. Include the resource's ID, any server-generated fields like timestamps and UUIDs, and always include a Location header pointing to the new resource URI.
When to use 201 vs 200? +
Use 201 Created when a NEW resource has been created as a direct result of the request, such as after a POST that inserts a new database record. Use 200 OK for general success scenarios like retrieving data with GET or updating an existing resource with PUT/PATCH. The key distinction is whether something new was brought into existence.