Error: malformed_body
The request body is not valid JSON.
malformed_body
malformed_bodyHTTP 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/jsonheader 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
- Validate the JSON body before sending. Paste it into jsonlint.com or run
echo '$BODY' | jq .. - Confirm
Content-Type: application/jsonis set on every request. - If using
curl, wrap the-dargument in single quotes or use--data @file.jsonto prevent shell substitution. - 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
| Language | Exception class |
|---|---|
| TypeScript | IsaMalformedBodyError |
| Python | IsaMalformedBodyError |
| Go | *zyins.MalformedBodyError |
| PHP | Isa\Sdk\Zyins\Exception\IsaMalformedBodyException |
| C# | IsaMalformedBodyException |
See also
Updated about 10 hours ago