400 Bad Request

The receiving server rejected the request as invalid before it could complete the intended operation.

All HTTP status codes

What does HTTP 400 mean?

A 400 is a broad rejection, so the useful evidence usually sits beside the status: an error body, request identifier or parser log. Identify whether the application, proxy or web server rejected the request. A valid-looking browser URL can still produce 400 because of malformed JSON, conflicting headers or request framing that an intermediary cannot accept.

An investigation example

Illustrative API investigation
Response: 400 Bad Request
Error log: malformed JSON near the final field
Client sent a trailing comma after a release.
Action: repair request serialization.
Verify: the same valid payload reaches validation and completes normally.

Common causes

  • The request body is truncated, malformed or does not match its declared content type.
  • Cookies, headers or an invalid hostname trigger an early web-server or gateway rejection.
  • A client library constructs an invalid request after a configuration or encoding change.

Diagnose the response

Reproduce the smallest failing request and compare its method, headers and body with a known working request.

  • Reproduce the failure with the same method, URL, headers and body, then compare it with a known working request. Redact tokens and cookies before sharing the capture.
  • Identify the rejecting layer from its response and request identifier. Check edge and web-server logs as well as application exceptions.
  • Correct the request at its source instead of weakening request parsing. For a browser-only failure, inspect site-specific cookies and extensions before clearing unrelated browser data.

What it means for website monitoring

When a Sitepulse request differs from a browser result, compare the actual headers and URL. Avoid changing availability rules until the rejecting layer and invalid request element are understood.

Reference