Skip to main content
HTTP/4xx (Client Error)

400 Bad Request

The server cannot or will not process the request due to an apparent client error (e.g., malformed syntax, invalid framing, or deceptive routing).

❓ Why does this happen?

Invalid JSON body, missing required parameters, or invalid header formatting sent by client.

✅ How to fix it

Inspect the request body and URL query parameters against the API schema documentation.

Return or handle 400 in your stack

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

Live 400 mock endpoint

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

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

400 vs similar status codes

Frequently Asked Questions

What does HTTP Status 400 mean?
The server cannot or will not process the request due to an apparent client error (e.g., malformed syntax, invalid framing, or deceptive routing).
Why am I getting a 400 status code?
Invalid JSON body, missing required parameters, or invalid header formatting sent by client.
How do I fix a 400 Bad Request error?
Inspect the request body and URL query parameters against the API schema documentation.
What is the difference between 400 Bad Request and 422 Unprocessable Content?
400 means the request is syntactically malformed (invalid JSON, bad framing). 422 means it parsed fine but failed validation rules (e.g. Zod or Pydantic errors).
How can I test how my app handles a 400 response?
Send a request to https://castov.com/api/mock/400 — it returns a real 400 Bad Request response with CORS enabled. Add ?delay=2000 to simulate a slow server.

Other 4xx status codes

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