# cesop.validate

Check CESOP Payment Data XML 4.03 against the official XSD and stateless rules from the DG TAXUD Validation Module 1.7.1. $0.45 per started 1,000 transactions, minimum one unit for processable XML. The module is available under the CESOP EULA 1.0 with the original distribution at https://taxation-customs.ec.europa.eu/document/download/40729317-f4f7-4a80-92b7-646bf1ca387b_en?filename=CESOP+Validation+Module+v1.7.1+User+Manual+v6.00.zip.

- REST: `POST https://api.kanagu.dev/v1/cesop/validate`
- MCP: `call_operation` with `operation: "cesop.validate"` at https://api.kanagu.dev/mcp
- Price: $0.45 USD per 1,000 transactions, on successful calls only.
- Auth: `Authorization: Bearer <key>` for REST and `call_operation`. Retries: reuse `Idempotency-Key` (MCP: `idempotencyKey`).

## Compliance coverage

- Domain: Tax & e-invoicing
- Jurisdictions: EU
- Standard: Council Directive 2006/112/EC VAT territory, Articles 5–7 (2025-04-14) — https://eur-lex.europa.eu/eli/dir/2006/112/2025-04-14/eng
- Standard: Council Directive (EU) 2020/284 Articles 243a–243d (2020-02-18) — https://eur-lex.europa.eu/eli/dir/2020/284/oj/eng
- Standard: Commission Implementing Regulation (EU) 2022/1504 Annex (2022-04-06) — https://eur-lex.europa.eu/eli/reg_impl/2022/1504/oj/eng
- Standard: DG TAXUD CESOP Reporting Guidelines 1.2 (2025-06-18) — https://taxation-customs.ec.europa.eu/document/download/3d5c333b-2268-4397-b688-4d3e547c1b72_en?filename=Guidelines+for+reporting+v1.2+18-06-25.pdf
- Standard: CESOP PaymentData, common types and ISO code lists XSD 4.03 / User Guide 6.00 (2024-11-08) — https://financnisprava.gov.cz/assets/cs/prilohy/ms-mezinarodni-spoluprace-a-dph/CESOP_XSD-User-%20Guide-v6_00_corresponding-XSD-package.zip
- Standard: European Commission CESOP Validation Module 1.7.1 / User Manual 6.00 (2025-10-20) — https://taxation-customs.ec.europa.eu/document/download/40729317-f4f7-4a80-92b7-646bf1ca387b_en?filename=CESOP+Validation+Module+v1.7.1+User+Manual+v6.00.zip
- Verification: Payment Data XML is checked against the official CESOP 4.03 XSD and the Commission's stateless rules in Validation Module 1.7.1.
- Last reviewed: 2026-11-26

## Request body

- `xml` (string (max 16777216 chars), required)

## Response

- `valid` (boolean, required)
- `schemaVersion` ("4.03", required)
- `moduleVersion` ("1.7.1", required)
- `processable` (boolean, required): The validator could process the XML and check its schema.
- `xsd` ("passed" | "failed", required)
- `statelessRules` ("passed" | "failed" | "not_checked", required)
- `transactionCount` (integer (0 to 10000), required)
- `findings` (array of object, required)
- `findings[].rule` (string, required)
- `findings[].path` (string, required)
- `findings[].expected` (string, required)
- `findings[].actual` (string, required)
- `findings[].source` (string (uri), required)
- `findings[].line` (integer (≤ 9007199254740991))
- `findings[].column` (integer (0 to 9007199254740991))
- `findings[].occurrences` (integer (≤ 9007199254740991))
- `findings[].docRefId` (string)
- `findings[].transactionId` (string)

## Example

```sh
curl https://api.kanagu.dev/v1/cesop/validate \
  -H "Authorization: Bearer $KANAGU_KEY" \
  -H "Content-Type: application/json" \
  -d '{"xml":"<?xml version=\"1.0\" encoding=\"UTF-8\"?><CESOP version=\"4.03\" xmlns=\"urn:ec.europa.eu:taxud:fiscalis:cesop:v1\"><MessageSpec><TransmittingCountry>DE</TransmittingCountry><MessageType>PMT</MessageType><MessageTypeIndic>CESOP102</MessageTypeIndic><MessageRefId>4093e599-ce2e-40e9-9a8b-7c10aa94f729</MessageRefId><ReportingPeriod><Quarter>3</Quarter><Year>2026</Year></ReportingPeriod><Timestamp>2026-10-15T09:00:00Z</Timestamp></MessageSpec><PaymentDataBody><ReportingPSP><PSPId PSPIdType=\"BIC\">DEUTDEFF</PSPId></ReportingPSP></PaymentDataBody></CESOP>"}'
```

```ts
const res = await fetch("https://api.kanagu.dev/v1/cesop/validate", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.KANAGU_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "xml": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><CESOP version=\"4.03\" xmlns=\"urn:ec.europa.eu:taxud:fiscalis:cesop:v1\"><MessageSpec><TransmittingCountry>DE</TransmittingCountry><MessageType>PMT</MessageType><MessageTypeIndic>CESOP102</MessageTypeIndic><MessageRefId>4093e599-ce2e-40e9-9a8b-7c10aa94f729</MessageRefId><ReportingPeriod><Quarter>3</Quarter><Year>2026</Year></ReportingPeriod><Timestamp>2026-10-15T09:00:00Z</Timestamp></MessageSpec><PaymentDataBody><ReportingPSP><PSPId PSPIdType=\"BIC\">DEUTDEFF</PSPId></ReportingPSP></PaymentDataBody></CESOP>"
  }),
});
if (!res.ok) throw new Error((await res.json()).error.message);
const result = await res.json();
```

## Errors

JSON `{"error":{"code","message"}}`.

- 400 `invalid_input`: The body does not match the request schema. The message names each field.
- 400 `invalid_json`: The body is missing or is not valid JSON.
- 400 `invalid_idempotency_key`: Idempotency-Key must be 1–128 visible ASCII characters.
- 401 `invalid_api_key`: The Bearer key is missing, malformed, invalid or inactive.
- 402 `free_allowance_exhausted`: This month's free usage is used up and the account has no subscription. Subscribe from the dashboard, or wait for the next UTC month; Retry-After gives the seconds left.
- 404 `not_found`: No operation at this path.
- 409 `idempotency_conflict`: The Idempotency-Key was already used with a different body.
- 413 `payload_too_large`: JSON bodies may be at most 64 KiB.
- 500 `internal_error`: The call failed on our side. It is not billed; retry with the same Idempotency-Key.

## JSON Schema

Request:
```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "xml": {
      "type": "string",
      "minLength": 1,
      "maxLength": 16777216
    }
  },
  "required": [
    "xml"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "xml": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><CESOP version=\"4.03\" xmlns=\"urn:ec.europa.eu:taxud:fiscalis:cesop:v1\"><MessageSpec><TransmittingCountry>DE</TransmittingCountry><MessageType>PMT</MessageType><MessageTypeIndic>CESOP102</MessageTypeIndic><MessageRefId>4093e599-ce2e-40e9-9a8b-7c10aa94f729</MessageRefId><ReportingPeriod><Quarter>3</Quarter><Year>2026</Year></ReportingPeriod><Timestamp>2026-10-15T09:00:00Z</Timestamp></MessageSpec><PaymentDataBody><ReportingPSP><PSPId PSPIdType=\"BIC\">DEUTDEFF</PSPId></ReportingPSP></PaymentDataBody></CESOP>"
    }
  ]
}
```

Response:
```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "valid": {
      "type": "boolean"
    },
    "schemaVersion": {
      "type": "string",
      "const": "4.03"
    },
    "moduleVersion": {
      "type": "string",
      "const": "1.7.1"
    },
    "processable": {
      "type": "boolean",
      "description": "The validator could process the XML and check its schema."
    },
    "xsd": {
      "type": "string",
      "enum": [
        "passed",
        "failed"
      ]
    },
    "statelessRules": {
      "type": "string",
      "enum": [
        "passed",
        "failed",
        "not_checked"
      ]
    },
    "transactionCount": {
      "type": "integer",
      "minimum": 0,
      "maximum": 10000
    },
    "findings": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "rule": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "expected": {
            "type": "string"
          },
          "actual": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "format": "uri"
          },
          "line": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "column": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "occurrences": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "docRefId": {
            "type": "string"
          },
          "transactionId": {
            "type": "string"
          }
        },
        "required": [
          "rule",
          "path",
          "expected",
          "actual",
          "source"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "valid",
    "schemaVersion",
    "moduleVersion",
    "processable",
    "xsd",
    "statelessRules",
    "transactionCount",
    "findings"
  ],
  "additionalProperties": false
}
```
