400 Bad Request

The server can't parse or won't accept the request.

4xx · Client error

What it means

The server can't or won't process the request because of something it sees as a client error: malformed syntax, an invalid message frame, or a request that breaks the API's rules.

It's the catch-all client error. When a more specific code fits, such as 401, 404, 413, 415 or 422, use that instead.

Why you're seeing it

  • Invalid JSON, or a body that doesn't match its Content-Type.
  • Missing or malformed required parameters.
  • Bad characters in the URL, or a malformed header.
  • Oversized or corrupted cookies; nginx reports these as 400.

How to fix it

  • Return an error body that says exactly which field is wrong and why.
  • On the client, validate the payload and check headers and URL encoding.
  • If only one browser fails, clear the site's cookies.

Example response

HTTP/1.1 400 Bad Request
Content-Type: application/problem+json

{"title": "Invalid JSON", "detail": "Unexpected token at position 18"}