HTTP 201 Created — What It Means and How to Fix It

The HTTP 201 (Created) status code indicates that the request has been fulfilled and has resulted in one or more new resources being created. This is typically returned after a successful POST or PUT request that creates a new resource on the server.

Last updated: 2026-06-11

RECOMMENDED

Essential Reading: Designing Data-Intensive Applications

The system design bible for software engineers. Learn to build reliable, scalable, and maintainable systems.

View on Amazon →
Status Code 201
Name Created

Common Causes

  • Successful creation of a new resource via a POST request (e.g., creating a new user, product, or document).
  • Successful creation or update of a resource via a PUT request where the resource did not previously exist.
  • A server-side process successfully generating a new resource based on the client's request.

Code Examples to Handle HTTP 201

curl -I https://httpbin.org/status/201

How to Fix It

  1. Verify the request method: Ensure a POST or PUT method was used, as 201 is not typically expected for GET or DELETE.
  2. Check the response body: The response body should ideally contain a representation of the newly created resource.
  3. Inspect the 'Location' header: The server should include a 'Location' header with a URI pointing to the newly created resource.
  4. Confirm idempotency (for PUT): If a PUT request resulted in 201, it implies the resource was created. Subsequent identical PUT requests to the same URI should ideally return 200 OK or 204 No Content if the resource already exists and is updated, not 201 again.
💡 Example: A user submits a form to create a new blog post. The client sends a POST request to `/api/posts` with the post's data. The server successfully processes the request, creates the new blog post in the database, and responds with a 201 Created status code, including a 'Location' header like `/api/posts/123` and a JSON representation of the new post in the response body.
🛠️ Developer Tip: Always include a 'Location' header in your 201 responses, pointing to the URI of the newly created resource. This is crucial for RESTful API design and allows clients to easily access the new resource.

Related Status Codes

Frequently Asked Questions

What causes HTTP 201?

HTTP 201 is caused by a successful request (typically POST or PUT) that results in the creation of one or more new resources on the server. It signifies that the server has understood the request and successfully fulfilled the creation operation.

How do I fix HTTP 201?

HTTP 201 is generally a success code, so it doesn't need 'fixing' in the traditional sense. If you're receiving it unexpectedly, ensure your client-side logic correctly handles the creation of resources and expects this response. For server-side, ensure your API correctly returns 201 only when a new resource is genuinely created and includes the 'Location' header.