4xx Client error
HTTP 400 Bad Request
The server can't process the request because it looks malformed.
A 400 Bad Request means the server couldn't understand the request because something in it is malformed. It's a generic client-side error: the server is telling you the request itself is wrong, not that the server is broken.
Common causes of a 400 error
- Invalid JSON or other body syntax, such as a trailing comma or unquoted key.
- A malformed URL, for example illegal characters that aren't percent-encoded.
- Missing or invalid required parameters, headers, or fields.
- Cookies or request headers that have grown too large.
- A Content-Length that doesn't match the body, or a corrupted request.
How to fix a 400 error
- Read the response body. APIs usually say which field or header was rejected.
- Validate your JSON with a formatter and check it's sent with Content-Type: application/json.
- Percent-encode special characters in the URL and query string.
- In a browser, clear the site's cookies and cache, then reload.
- Compare the failing request with a working one, for example using your browser's network tab.
Frequently asked questions
What's the difference between 400 and 422?
400 means the request couldn't be parsed at all, such as broken JSON. 422 means it was parsed fine but the values failed validation, such as an email field that isn't an email. Many APIs use 400 for both, so check the response body.
Why do I get a 400 in the browser with no obvious mistake?
Usually the site's cookies have grown too large or become corrupted. Clearing cookies for that site fixes most browser-side 400 errors.
Other common status codes
See 400 in the full searchable list, or use the HTTP Header Checker to see the status code any URL returns.