Validate statement against XSD
validate_statementValidates a camt.05x statement XML against its ISO 20022 schema and returns a validation report with status, message type, and errors.
Instructions
Validate an incoming camt.05x statement XML against its XSD schema.
Use this to confirm a document is well-formed and schema-valid before
processing it. This checks XSD conformance only; for the Nov 2026 CBPR+
business rules use ``check_cbpr_readiness``, and to extract the data use
``parse_statement``.
Detects the document's message type, validates it against the matching
ISO 20022 schema, and returns a report ``{"valid": bool, "message_type":
str, "errors": [...]}``. A well-formed but schema-invalid document yields
``valid=False`` with a populated ``errors`` list (and the detected
``message_type``); a valid one yields ``valid=True`` with no errors.
Returns an ``{"error": ...}`` payload instead if the XML cannot be parsed
(e.g. it is malformed or is not a camt ``Document``).
Args:
xml: The raw statement XML as a string.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| xml | Yes | The raw camt.05x statement XML document as a string, with its root camt <Document> element. Validated against the matching ISO 20022 XSD; no file path is accepted. |