CanopyAPI docs

invalid_json

The request body never parsed as JSON. This is not a schema check that failed; nothing was read at all.

HTTP 400

When this happens

Only POST /api/v1/intents emits this code, because it is the one write route that reads a body. The handler runs JSON.parse on the raw request body, and refuses the request before inspecting any field if that throws. An empty body is treated as {}, so only a non-empty body that fails to parse lands here.

invalid_request fires instead when the body parses fine as JSON but fails schema validation, such as a missing or wrong-typed field. Both are 400s with different code values, because the fix differs: a parse failure means the bytes on the wire are not JSON, and a schema failure means the JSON is well-formed but wrong.

The error envelope

json
{
  "error": {
    "code": "invalid_json",
    "message": "The request body is not valid JSON.",
    "request_id": "req_1a2b3c4d5e6f7a8b9c0d1e2f",
    "docs": "https://canopypay.io/errors/invalid_json"
  }
}

param is never present. A parse failure has no field to name.

What to do about it

Check that the client serializes the body as JSON, with JSON.stringify(body) rather than a form-encoded or raw string body. Then check that nothing between the client and Canopy is truncating or re-encoding it: a proxy, a logging middleware or a hand-built HTTP client. This is always a client-side fix; retrying the identical bytes will fail identically.