201

HTTP 201 Created

2xx Success

2xx Success RFC 7231, Section 6.3.2

What is HTTP 201 Created?

The 201 (Created) status code indicates that the request has been fulfilled and has resulted in one or more new resources being created. The primary resource created is identified by a Location header in the response. This is typically used in RESTful APIs for POST and PUT requests that create new resources.

Common Use Cases

  • Creating a new user account via API
  • Adding a new record to a database
  • File upload completion

Usage Example

After a client sends a POST request to create a new user, respond with 201 Created and a Location header containing the new user's URL. The response body should include the created resource representation so the client does not need to make an additional GET request.

// Laravel - returning 201 Created
return response()->json($user, 201, [
    'Location' => route('users.show', $user),
]);

Common Mistakes

⚠️

Mistake: Returning 201 without a Location header

Fix: Always include a Location header with the URL of the newly created resource. This allows clients to cache and reference the resource without parsing the response body.

⚠️

Mistake: Using 201 for operations that do not create new resources

Fix: Reserve 201 strictly for resource creation. For updates, use 200 OK. For successful operations that return no content, use 204 No Content.

Last updated: 21 Jun 2026