201 Created
The HTTP 201 Created status code indicates a resource was successfully created by the request.
Usage
The 201 Created status code is returned in response to a POST request, confirming the resource was uploaded for the first time. The server should include a Location header pointing to the newly created resource. When the Location header is absent, the created resource lives at the path specified in the original request.
Note
A PUT request creating a resource at a specific URI also returns 201 Created. The distinction is the client specifies the target URI directly with PUT, while the server determines the URI with POST.
SEO impact
Google processes content from 201 responses the same way as 200. Content is passed to the indexing pipeline, but indexing is not guaranteed.
Example
The client uploads XML data to the server, specifying /incoming/xml as the destination path. The server responds confirming the data was accepted and a file named article_1.xml was created.
Request
POST /incoming/xml HTTP/1.1
Host: www.example.re
Content-Type: application/xml
Content-Length: 105
<?xml version="1.0"?>
<article>
<title>Test XML article</title>
<author>Anonymous</author>
</article>
Response
HTTP/1.1 201 Created
Location: /incoming/xml/article_1.xml
Content-Type: application/json
Content-Length: 18
{"success":"true"}
Code references
.NET
HttpStatusCode.Created
Rust
http::StatusCode::CREATED
Rails
:created
Go
http.StatusCreated
Symfony
Response::HTTP_CREATED
Python3.5+
http.HTTPStatus.CREATED
Java
java.net.HttpURLConnection.HTTP_CREATED
Apache HttpComponents Core
org.apache.hc.core5.http.HttpStatus.SC_CREATED
Angular
@angular/common/http/HttpStatusCode.Created
Takeaway
The HTTP 201 Created status code confirms data was received and saved as a new resource on the server. The request did not overwrite or update existing data.
See also
- RFC 9110: HTTP Semantics
- Google: HTTP status codes and network errors
- 200
- 204
- Location
- HTTP status codes