Skip to main content
HTTP/2xx (Success)

201 Created

The request has been fulfilled, resulting in the creation of a new resource on the server.

❓ Why does this happen?

Commonly returned after successful POST requests that insert database records or upload files.

✅ How to fix it

Expected behavior for resource creation endpoints. Include a Location header pointing to the created resource if applicable.

Return or handle 201 in your stack

// app/api/resource/route.ts
export function GET() {
  return Response.json(
    { error: "Created", status: 201 },
    {
      status: 201
    }
  );
}

Live 201 mock endpoint

Point your app, tests, or retry logic at this free public URL to reproduce a real 201 response (CORS enabled, optional ?delay=ms up to 5000).

https://castov.com/api/mock/201

201 vs similar status codes

Frequently Asked Questions

What does HTTP Status 201 mean?
The request has been fulfilled, resulting in the creation of a new resource on the server.
Why am I getting a 201 status code?
Commonly returned after successful POST requests that insert database records or upload files.
How do I fix a 201 Created error?
Expected behavior for resource creation endpoints. Include a Location header pointing to the created resource if applicable.
What is the difference between 201 Created and 200 OK?
201 signals a new resource was created and should include a Location header pointing to it; 200 is a generic success.
How can I test how my app handles a 201 response?
Send a request to https://castov.com/api/mock/201 — it returns a real 201 Created response with CORS enabled. Add ?delay=2000 to simulate a slow server.

Other 2xx status codes

Browse the full HTTP status codes directory or troubleshoot terminal errors in the Error Fix Encyclopedia.