201 Created

Success - A new resource was created

HTTP 201 Created

What It Means

The HTTP 201 Created status code indicates that the request has been fulfilled and a new resource has been created. This is the standard response for successful POST requests that create new entities.

When to Use 201

  • After a successful POST request that creates a new resource
  • When a PUT request creates a resource at a specific URL that didn't exist
  • Creating users, orders, posts, or any new entity in your API

Required Headers

Location Header

The 201 response should include a Location header pointing to the newly created resource:

Location: /api/users/456

Example Response

HTTP/1.1 201 Created
Content-Type: application/json
Location: /api/users/456

{
  "id": 456,
  "email": "[email protected]",
  "created_at": "2025-01-15T10:30:00Z"
}

201 vs 200

Scenario Use
POST creates new user 201
PUT updates existing user 200
POST adds item to cart 201
POST submits form (no new resource) 200

Best Practices

  • Always include the Location header
  • Return the created resource in the response body
  • Include the generated ID and timestamps
  • Don't use 201 for actions that don't create persistent resources

Monitor your API responses

Ensure your POST endpoints return correct status codes.

Start monitoring free →

Related Status Codes