201 Created
Fault: Neither
TL;DR
Successfully created a new resource as a result of the request.
The request has been fulfilled and a new resource has been created.
What HTTP 201 Created Means
The request has been fulfilled and a new resource has been created.
Successfully created a new resource as a result of the request.
Common Causes
- Successful POST request creating a resource
- Successful PUT creating a new resource
How to Fix It (For Visitors)
- No action needed - resource created successfully
How to Fix It (For Developers/Admins)
- Return 201 when creating new resources via POST/PUT
- Include Location header with new resource URI
Returning a 201 Created (Code Examples)
If you build APIs or web apps, here is how to send an HTTP 201 response and how to test for it:
Node.js (Express)
app.get('/resource', (req, res) => {
res.status(201).json({ error: 'Created' });
});
Python (Flask)
@app.route('/resource')
def resource():
return jsonify(error='Created'), 201
PHP
<?php
http_response_code(201);
header('Content-Type: application/json');
echo json_encode(['error' => 'Created']);
Check the status with curl
curl -I https://example.com/resource
# Look for: HTTP/1.1 201 Created
Frequently Asked Questions
What does HTTP 201 Created mean?
Successfully created a new resource as a result of the request. In short: The request has been fulfilled and a new resource has been created.
How should I handle an HTTP 201 Created response?
Return 201 when creating new resources via POST/PUT. Include Location header with new resource URI.
Official Specification
The 201 Created status code is defined in RFC 7231 Section 6.3.2.