Knowledge Base

Get Expert Website Hosting

Choose website reliability and expertise with SiteGround!

Home / Website Help / What Is HTTP 201 Status Code? Meaning, Examples, and When to Use It

What Is HTTP 201 Status Code? Meaning, Examples, and When to Use It

Last update: Sep 29, 2025 4 min read

Not all HTTP status codes are the same. Some simply confirm that a server request was successful, while others carry special meaning. The 201 status code tells you that the server has successfully created a new resource. Usually, this is in response to a POST request, or sometimes a PUT request, most commonly used with API services. 

In this article, we’ll explain in detail what the 201 Created response code means, look at examples from REST APIs and browser forms, and compare it to other similar HTTP status codes.

What Is the HTTP 201 Status Code?

The 201 status code means a request succeeded and created a new resource.

According to the HTTP/1.1 specification, a proper 201 server response code should include a Location header field.

That should point to the specific URI of the newly created or primary resource. It may also include a response body containing details about the requested data.

Diagram of client-server communication with HTTP request and HTTP response arrows, showing how servers respond to client actions that may trigger a 201 status code.

This behavior makes the 201 different from other server response codes. For example:

  • 200 OK simply means the request succeeded and returns the requested data, but does not necessarily create a new entity.
  • 201 Created explicitly signals that a new resource now exists at the effective request URI, or another forwarding address provided in the Location header.

In practice, 201 is most often used in REST APIs where a POST request adds a new user, blog post, uploaded file, or any other target resource. It can also apply in web forms, such as a signup page, where a server successfully fulfills the request and a new entity is saved in the database.

When to Use 201 (and When Not To)

The 201 status code applies when the server has successfully fulfilled a client’s request that results in something new. Below, we’ll list the most common use cases.

Correct Use Cases

  • User registration – Creating a new user account returns a 201 Created along with a Location header pointing to the profile page.
  • Blog post creationPublishing a blog post with a POST request should return 201 once the article is saved.
  • File upload – When an uploaded file is stored on the origin server, the response code should be 201 Created with a link to the target resource.
  • Ecommerce order – A checkout process where the server prepares a new order entry can return 201 plus a response body with the order ID.

Incorrect Use Cases

The 201 Created code should not be used if no new resource was generated. Common mistakes include:

  • Login or authentication – A request succeeded, but didn’t add a new entity. The proper status code is usually 200 OK.
  • Updating existing data – A PUT request that changes a current instance should return 200 OK or 204 No Content.
  • Search queries – Returning requested data doesn’t involve resource creation; 200 OK is correct.
  • Duplicate creation attempts – If the origin server refuses to create because the client’s identity already exists, return 409 Conflict.

Using the wrong response code can cause confusion for the user agent and lead to semantic errors or invalid responses in a REST API.

API Example: Creating a New User

The 201 status code is most often seen in APIs when a newly created resource is returned after a client’s request. Let’s look at a common case – creating a new user in a REST API.

For example, below is a sample POST request made to api.example.com:

POST /users HTTP/1.1
Host: api.example.com
Content-Type: application/json
{
"name": "John Doe",
"email": "john@example.com"
}

In this POST request, the user agent asks the origin server to add a new entity. Below, you can see a common server response:

HTTP/1.1 201 Created
Location: /users/123
Content-Type: application/json
{
"id": 123,
"name": "John Doe",
"email": "john@example.com"
}

The server response code 201 Created signals that the request succeeded and a new resource was added – a new user, John Doe, their email, and a respective user ID were successfully created.

Key points in this example:

  • The Location header field provides the specific URI where the primary resource created can be accessed.
  • The response body returns the requested data for the new user, confirming the resource creation.
  • The request was successfully completed in one step — no extra request method or forwarding address was required.

This is the most correct and standards-compliant way to use the HTTP 201 Created response code according to the HTTP specification.

Browser Example: Signup Form Demo (Practical Scenario)

While the 201 status code is most common in APIs, you can see it in action with a simple web form.

Let’s look at a demo signup page where a visitor can create a new user account.

Example of a signup form where a client submits name, email, and password, illustrating the request sent to the server that can return a 201 Created response.

When the form is submitted, the origin server processes the client’s request, stores the data, and returns the 201 Created response.

Confirmation message showing 'Account created' with a user ID, name, and location header, demonstrating a successful 201 Created response from the server.

In our demo:

  1. The visitor fills out their name, email, and password.
  2. The server validates the request header fields and saves the data as a newly created resource in the database.
  3. The server response code is 201 Created, along with a Location header pointing to the new profile.
  4. A confirmation page shows the details of the requested resource, proving the request was successfully fulfilled.

Keep in mind it is unlikely to see 201 response codes on the front-end of websites. 

This demo is meant to illustrate the process that usually happens “behind the scenes” when the server processes requests.

You can also use the browser’s Developer and Network tools to see how the status code is used in practice on actual applications.

201 vs. Other Similar Status Codes

The HTTP 201 Created response code often gets confused with other success codes. Here’s how it compares to related responses:

201 vs 200 OK

  • 200 OK means the request succeeded and the requested data is returned.
  • It does not indicate that a newly created resource exists.
  • For example: fetching a blog post or updating a current instance.

201 vs 202 Accepted

  • 202 Accepted means the client’s request was received and may be processed later.
  • There is no guarantee of a new entity being created yet.
  • For example: submitting a job to a queue for risk processing, like generating a PDF or handling a digital payment system.

201 vs 204 No Content

  • 204 No Content means the request was successful and there’s no message body to return.
  • Often used for a PUT request that updates an existing target resource.
  • No Location header or new resource is involved.
Response Code Meaning When to Use Example Scenario
200 OK Request succeeded, returns requested resource Standard retrieval or update Fetching a blog post
201 Created Request resulted in a newly created resource Resource creation via POST/PUT Creating a new user
202 Accepted Request accepted for processing, not completed yet Async tasks, job queues Generating a report in background
204 No Content Request succeeded, no response body returned Updates without return data Updating a profile with PUT

Key Takeaways About the 201 Status Code

Let’s sum up the main points about the 201 code:

  • The HTTP 201 status code confirms that the server successfully fulfilled a client’s request by creating a new resource.
  • A proper 201 server response code should include a Location header field pointing to the specific URI of the newly created resource and may also return a response body with details about the requested data.
  • The 201 Created response code is most common in REST APIs for resource creation (new user, blog post, uploaded file, or order).
  • Don’t confuse 201 with other HTTP status codes like 200 OK, 202 Accepted, or 204 No Content — each communicates a different outcome of the request method.
  • Using the correct HTTP status code means the user agent can handle the requested resource properly.

In short: 201 tells the client, ‘The request worked, and a new resource now exists’.

Share this article