Error: malformed_body

The request body is not valid JSON.

malformed_body

HTTP status: 400

The request body is not valid JSON, so the server rejects it before running any business logic.

Why this happens

Your request body may have an issue in any of these scenarios:

  • The Content-Type: application/json header is set but the body is not valid JSON.
  • The body is truncated or corrupted (for example, a network failure during transmission).
  • The body was serialized with a non-JSON encoder like XML, form-encoded, or msgpack.
  • A template substitution left an unquoted placeholder in the JSON string.

What to do

  1. Validate the JSON body before sending. Paste it into jsonlint.com or run echo '$BODY' | jq ..
  2. Confirm Content-Type: application/json is set on every request.
  3. If using curl, wrap the -d argument in single quotes or use --data @file.json to prevent shell substitution.
  4. If using an SDK, this error should never occur — the SDK handles serialization automatically. If it does, report a bug with your SDK version and the input that caused it.

Example response

{
  "type": "https://zyins.isaapi.com/errors/malformed-body",
  "title": "Malformed request body",
  "status": 400,
  "detail": "Request body is not valid JSON. Verify the body and Content-Type header.",
  "code": "malformed_body",
  "advice_code": "validate_json",
  "param": null,
  "request_id": "req_01HZK2N5GQR9T8X4B6FJW3Y1AS"
}

SDK exceptions

LanguageException class
TypeScriptIsaMalformedBodyError
PythonIsaMalformedBodyError
Go*zyins.MalformedBodyError
PHPIsa\Sdk\Zyins\Exception\IsaMalformedBodyException
C#IsaMalformedBodyException

See also