Back to Status Codes
Client Error (4xx)

HTTP 400 Bad Request

The request was malformed or invalid. The server cannot process it.

400

Bad Request

The request was malformed or invalid. The server cannot process it.

What Causes HTTP 400?

  • Malformed JSON or XML in request body
  • Missing required fields or parameters
  • Invalid data types or format
  • Request exceeds size limits
  • Invalid query parameters

Code Examples

See how HTTP 400 responses look in different programming languages and tools.

curl -X POST https://api.example.com/users \
  -H "Content-Type: application/json" \
  -d 'invalid json'
# Response: 400 Bad Request

How to Fix HTTP 400

  • Check the request body format and syntax
  • Validate all required fields are present and correct
  • Review API documentation for correct request format
  • Ensure JSON/XML is properly escaped and formatted
  • Check for size limits on request payload

Related Status Codes

Test Your APIs

Frequently Asked Questions

What does HTTP 400 mean?

The request was malformed or invalid. The server cannot process it.

What causes HTTP 400?

Malformed JSON or XML in request body. Missing required fields or parameters. Invalid data types or format. Request exceeds size limits. Invalid query parameters

How to fix HTTP 400?

Check the request body format and syntax. Validate all required fields are present and correct. Review API documentation for correct request format. Ensure JSON/XML is properly escaped and formatted. Check for size limits on request payload

http 400bad request errorhttp status codesapi error handlingrest api client error