400 Bad Request

The HTTP status meaning the request is malformed or asks for something outside what the API allows, such as a page size above the maximum.

In more detail

Use a more specific 4xx code when one fits, and always explain the problem in a problem details body. Repeating the same request will fail again, so the client must change it.

Examples

In the APIs course: The course service answers 400 for a limit outside 1 to the maximum and for an unsupported sort key.
The course's strict signup answers unknown fields with a bad request that names them, turning schema probing into a visible signal.

Related terms

Taught in

References