📚 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
POST /api/users HTTP/1.1 Host: api.example.com Content-Type: application/json { "name": "Jane Doe", "email": "jane@example.com" }
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" }