# dac7.validate

Check DAC7 DPI v1.0 against the official XSD, EU or Irish Revenue rules, and supplied DocRefId history. Up to 500 sellers per file.

- REST: `POST https://api.kanagu.dev/v1/dac7/validate`
- MCP: `call_operation` with `operation: "dac7.validate"` at https://api.kanagu.dev/mcp
- Price: $0.15 USD per seller, 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, IE
- Standard: Council Directive (EU) 2021/514, Annex V 2021/514 (2021-03-22) — https://eur-lex.europa.eu/eli/dir/2021/514/oj
- Standard: DG TAXUD DAC7 DPI XML Schema and User Guide 4.00 EN / XSD 1.0 (2023-06-07) — https://info.portaldasfinancas.gov.pt/pt/apoio_ao_contribuinte/Outras_entidades/Suporte_tecnologico/Trocas_Info_Internacionais/AEOI_DAC7_DPI/Documents/DPI_DAC7_XML_Schema_and_User_Guide_v4_00.zip
- Standard: Irish Revenue DAC7/MRDP XSD 1.0 (2024-11-14) — https://www.revenue.ie/en/online-services/support/software-developers/documents/aeoi/dac7-xsd.xsd
- Standard: Irish Revenue OECD common types 1.0 (2026-01-22) — https://www.revenue.ie/en/online-services/support/software-developers/documents/aeoi/oecd-common-types.xsd
- Standard: Irish Revenue DPI ISO types (including country and currency codes) 1.0 (2026-01-22) — https://www.revenue.ie/en/online-services/support/software-developers/documents/aeoi/iso-types.xsd
- Standard: Irish Revenue DAC7/MRDP registration and filing FAQs 2026-09-25 snapshot (2026-09-25) — https://www.revenue.ie/en/companies-and-charities/documents/aeoi/dac7-reg-faqs.pdf
- Standard: Irish Revenue DPI Schema User Guide 3.00 EN (2022-12-15) — https://www.revenue.ie/en/online-services/support/software-developers/documents/aeoi/dpi-xml-schema-user-guide-v3.00.pdf
- Standard: Irish Revenue DAC7 API Functional Design Specifications 1.3 (2026-01-22) — https://www.revenue.ie/en/online-services/support/software-developers/documents/aeoi/api-fds-v1.3.pdf
- Verification: Both operations run libxml2 against the official DPI 1.0 XSD and check report structure, local rules and supplied filing history.
- Last reviewed: 2026-11-26

## Request body

- `profile` ("eu" | "ireland", required)
- `xml` (string (max 4194304 chars), required)
- `history` (array of string (max 4194304 chars))

## Response

- `valid` (boolean, required)
- `profile` ("eu" | "ireland", required)
- `xsd` (object, required)
- `xsd.version` ("1.0", required)
- `xsd.source` (string, required)
- `xsd.status` ("passed" | "failed" | "not_run", required)
- `reportableSellers` (integer (0 to 9007199254740991), required)
- `errors` (array of object, required)
- `errors[].path` (string, required)
- `errors[].line` (integer (≤ 9007199254740991))
- `errors[].rule` (string, required)
- `errors[].expected` (string, required)
- `errors[].actual` (string, required)
- `errors[].source` (string, required)
- `needsReview` (array of object, required)
- `needsReview[].path` (string, required)
- `needsReview[].line` (integer (≤ 9007199254740991))
- `needsReview[].rule` (string, required)
- `needsReview[].expected` (string, required)
- `needsReview[].actual` (string, required)
- `needsReview[].source` (string, required)

## Example

```sh
curl https://api.kanagu.dev/v1/dac7/validate \
  -H "Authorization: Bearer $KANAGU_KEY" \
  -H "Content-Type: application/json" \
  -d '{"profile":"eu","xml":"<DPI_OECD xmlns=\"urn:oecd:ties:dpi:v1\" version=\"1.0\"><MessageSpec><TransmittingCountry>IE</TransmittingCountry><ReceivingCountry>FR</ReceivingCountry><MessageType>DPI</MessageType><MessageRefId>IE2026FR-NIL01</MessageRefId><MessageTypeIndic>DPI403</MessageTypeIndic><ReportingPeriod>2026-12-31</ReportingPeriod><Timestamp>2027-02-01T12:00:00</Timestamp></MessageSpec></DPI_OECD>","history":[]}'
```

```ts
const res = await fetch("https://api.kanagu.dev/v1/dac7/validate", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.KANAGU_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "profile": "eu",
    "xml": "<DPI_OECD xmlns=\"urn:oecd:ties:dpi:v1\" version=\"1.0\"><MessageSpec><TransmittingCountry>IE</TransmittingCountry><ReceivingCountry>FR</ReceivingCountry><MessageType>DPI</MessageType><MessageRefId>IE2026FR-NIL01</MessageRefId><MessageTypeIndic>DPI403</MessageTypeIndic><ReportingPeriod>2026-12-31</ReportingPeriod><Timestamp>2027-02-01T12:00:00</Timestamp></MessageSpec></DPI_OECD>",
    "history": []
  }),
});
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": {
    "profile": {
      "type": "string",
      "enum": [
        "eu",
        "ireland"
      ]
    },
    "xml": {
      "type": "string",
      "minLength": 1,
      "maxLength": 4194304
    },
    "history": {
      "maxItems": 20,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 4194304
      }
    }
  },
  "required": [
    "profile",
    "xml"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "profile": "eu",
      "xml": "<DPI_OECD xmlns=\"urn:oecd:ties:dpi:v1\" version=\"1.0\"><MessageSpec><TransmittingCountry>IE</TransmittingCountry><ReceivingCountry>FR</ReceivingCountry><MessageType>DPI</MessageType><MessageRefId>IE2026FR-NIL01</MessageRefId><MessageTypeIndic>DPI403</MessageTypeIndic><ReportingPeriod>2026-12-31</ReportingPeriod><Timestamp>2027-02-01T12:00:00</Timestamp></MessageSpec></DPI_OECD>",
      "history": []
    }
  ]
}
```

Response:
```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "valid": {
      "type": "boolean"
    },
    "profile": {
      "type": "string",
      "enum": [
        "eu",
        "ireland"
      ]
    },
    "xsd": {
      "type": "object",
      "properties": {
        "version": {
          "type": "string",
          "const": "1.0"
        },
        "source": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "passed",
            "failed",
            "not_run"
          ]
        }
      },
      "required": [
        "version",
        "source",
        "status"
      ],
      "additionalProperties": false
    },
    "reportableSellers": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "errors": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string"
          },
          "line": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "rule": {
            "type": "string"
          },
          "expected": {
            "type": "string"
          },
          "actual": {
            "type": "string"
          },
          "source": {
            "type": "string"
          }
        },
        "required": [
          "path",
          "rule",
          "expected",
          "actual",
          "source"
        ],
        "additionalProperties": false
      }
    },
    "needsReview": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string"
          },
          "line": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "rule": {
            "type": "string"
          },
          "expected": {
            "type": "string"
          },
          "actual": {
            "type": "string"
          },
          "source": {
            "type": "string"
          }
        },
        "required": [
          "path",
          "rule",
          "expected",
          "actual",
          "source"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "valid",
    "profile",
    "xsd",
    "reportableSellers",
    "errors",
    "needsReview"
  ],
  "additionalProperties": false
}
```
