201 Created HTTP Status Code

Description

The HTTP status code 201, "Created", indicates that a request has been successful and resulted in the creation of a new resource. This typically occurs when a client submits a POST request to the server.

Here's a breakdown of what a 201 status code means:

  • Successful request: The server processed the client's request without errors.
  • New resource created: The request resulted in the creation of a new resource on the server. This could be anything from a new user account to a new document.
  • Location details: The server often includes a "Location" header in the response that specifies the URL of the newly created resource. This allows the client to access or interact with the new resource.

In contrast, a general success code like 200 "OK" might be used for requests that retrieve existing data, while 201 is specifically for creating new resources.

Status

HTTP
201 Created

Common Causes

Here are some common scenarios or causes for receiving a HTTP status code 201:

  1. Creating a New Resource: The most direct cause of a 201 status code is the successful creation of a new resource on the server following a client’s request. For example, when a user submits a form to create a new account, if the account is successfully created, the server might respond with a 201 status code.

  2. Successful POST Request: A POST request is used when the client wants to send data to the server to create or update a resource. If this process is successful, and a new resource is created as a result, the server responds with a 201 status code. This is common in RESTful APIs when adding new entries to a database.

  3. APIs Creating Resources: Many web APIs use the 201 status code to signal that a request to create a new entity, such as a user, post, or transaction, was successful. It's a way for the API to communicate to the client application that it successfully processed the request to create something new.

  4. Asynchronous Processing: In some cases, the request made by the client initiates a process that results in the creation of a new resource, but the process itself might be asynchronous. The server might immediately respond with a 201 status code to acknowledge that the process has started successfully, even if the actual resource creation is still underway.

  5. Conditional Creation: Sometimes, a resource is only created under certain conditions (for example, if it doesn’t already exist). A 201 status code might be returned when such conditions are met, and the server successfully creates the new resource as requested by the client.

It's worth noting that when a 201 status code is returned, the response often includes a Location header. This header points to the URL of the newly created resource. This is helpful for clients, as it provides a direct link to the resource that was just created, allowing for further interactions with it.

Browser Support

The following table will show you the current browser support for the 201 Created HTTP status code.

Desktop
Edge Chrome Firefox Opera Safari
YesYesYesYesYes
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview
YesYesYesYesYesYes

Last updated by CSSPortal on: 31st March 2024