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/400400 vs similar status codes
Frequently Asked Questions
What does HTTP Status 400 mean?
Why am I getting a 400 status code?
How do I fix a 400 Bad Request error?
What is the difference between 400 Bad Request and 422 Unprocessable Content?
How can I test how my app handles a 400 response?
Other 4xx status codes
Browse the full HTTP status codes directory or troubleshoot terminal errors in the Error Fix Encyclopedia.