Skip to content
UK CARF

carf.validate

Check UK CARF XML v1.5 against the OECD XSD, HMRC file rules and supported TIN formats. Billed per user processed after XSD validation, up to 10,000.

POSThttps://api.kanagu.dev/v1/carf/validate
Price
$0.10 per user, on successful calls only
Without a key
10 free calls per IP per UTC day, shared by REST and MCP.
MCP tool
carf.validate at https://api.kanagu.dev/mcp
curl https://api.kanagu.dev/v1/carf/validate \
  -H "Content-Type: application/json" \
  -d '{"xml":"<?xml version=\"1.0\" encoding=\"UTF-8\"?><CARF_OECD xmlns=\"urn:oecd:ties:carf:v1\" version=\"1.5\"><MessageSpec><SendingEntityIN>XRCASP000001234</SendingEntityIN><TransmittingCountry>GB</TransmittingCountry><ReceivingCountry>GB</ReceivingCountry><MessageType>CARF</MessageType><MessageRefId>GB2026GB-XRCASP000001234-nil</MessageRefId><MessageTypeIndic>CARF703</MessageTypeIndic><ReportingPeriod>2026-12-31</ReportingPeriod><Timestamp>2027-05-01T09:00:00</Timestamp></MessageSpec></CARF_OECD>","filename":"GB2026GB-XRCASP000001234-nil.xml"}'
curl https://api.kanagu.dev/v1/carf/validate \
  -H "Authorization: Bearer $KANAGU_KEY" \
  -H "Content-Type: application/json" \
  -d '{"xml":"<?xml version=\"1.0\" encoding=\"UTF-8\"?><CARF_OECD xmlns=\"urn:oecd:ties:carf:v1\" version=\"1.5\"><MessageSpec><SendingEntityIN>XRCASP000001234</SendingEntityIN><TransmittingCountry>GB</TransmittingCountry><ReceivingCountry>GB</ReceivingCountry><MessageType>CARF</MessageType><MessageRefId>GB2026GB-XRCASP000001234-nil</MessageRefId><MessageTypeIndic>CARF703</MessageTypeIndic><ReportingPeriod>2026-12-31</ReportingPeriod><Timestamp>2027-05-01T09:00:00</Timestamp></MessageSpec></CARF_OECD>","filename":"GB2026GB-XRCASP000001234-nil.xml"}'
const res = await fetch("https://api.kanagu.dev/v1/carf/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\"?><CARF_OECD xmlns=\"urn:oecd:ties:carf:v1\" version=\"1.5\"><MessageSpec><SendingEntityIN>XRCASP000001234</SendingEntityIN><TransmittingCountry>GB</TransmittingCountry><ReceivingCountry>GB</ReceivingCountry><MessageType>CARF</MessageType><MessageRefId>GB2026GB-XRCASP000001234-nil</MessageRefId><MessageTypeIndic>CARF703</MessageTypeIndic><ReportingPeriod>2026-12-31</ReportingPeriod><Timestamp>2027-05-01T09:00:00</Timestamp></MessageSpec></CARF_OECD>",
    "filename": "GB2026GB-XRCASP000001234-nil.xml"
  }),
});
if (!res.ok) throw new Error((await res.json()).error.message);
const result = await res.json();
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "carf.validate",
    "arguments": {
      "xml": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><CARF_OECD xmlns=\"urn:oecd:ties:carf:v1\" version=\"1.5\"><MessageSpec><SendingEntityIN>XRCASP000001234</SendingEntityIN><TransmittingCountry>GB</TransmittingCountry><ReceivingCountry>GB</ReceivingCountry><MessageType>CARF</MessageType><MessageRefId>GB2026GB-XRCASP000001234-nil</MessageRefId><MessageTypeIndic>CARF703</MessageTypeIndic><ReportingPeriod>2026-12-31</ReportingPeriod><Timestamp>2027-05-01T09:00:00</Timestamp></MessageSpec></CARF_OECD>",
      "filename": "GB2026GB-XRCASP000001234-nil.xml"
    }
  }
}
Request body
{
  "xml": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><CARF_OECD xmlns=\"urn:oecd:ties:carf:v1\" version=\"1.5\"><MessageSpec><SendingEntityIN>XRCASP000001234</SendingEntityIN><TransmittingCountry>GB</TransmittingCountry><ReceivingCountry>GB</ReceivingCountry><MessageType>CARF</MessageType><MessageRefId>GB2026GB-XRCASP000001234-nil</MessageRefId><MessageTypeIndic>CARF703</MessageTypeIndic><ReportingPeriod>2026-12-31</ReportingPeriod><Timestamp>2027-05-01T09:00:00</Timestamp></MessageSpec></CARF_OECD>",
  "filename": "GB2026GB-XRCASP000001234-nil.xml"
}

Request body

application/json

historyarray of string
Complete prior accepted CARF XML, oldest first. For correct, supply the files before previousXml.
xmlstringrequired
filenamestring (max 255 chars)

Response

200 · application/json

validbooleanrequired
reportableUsersinteger (0 to 10000)required
errorsarray of objectrequired
errors[].rulestringrequired
errors[].pathstringrequired
errors[].lineinteger (≤ 9007199254740991)
errors[].expectedstringrequired
errors[].actualstringrequired
errors[].sourcestringrequired
needsReviewarray of objectrequired
needsReview[].rulestringrequired
needsReview[].pathstringrequired
needsReview[].lineinteger (≤ 9007199254740991)
needsReview[].expectedstringrequired
needsReview[].actualstringrequired
needsReview[].sourcestringrequired
schemaVersion"1.5"required

Try it

carf.validate

$0.10/user

No key needed · 10 free calls per IP per day

Response

Run the request to see the live response here.

Errors

Errors are JSON {"error":{"code","message"}}. An operation may add its own 400 codes; the message says what to fix.

StatusCode and meaning
400invalid_input

The body does not match the request schema. The message names each field.

400invalid_json

The body is missing or is not valid JSON.

400invalid_idempotency_key

Idempotency-Key must be 1–128 visible ASCII characters.

401invalid_api_key

The Bearer key is missing, malformed, invalid or inactive.

402free_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.

404not_found

No operation at this path.

409idempotency_conflict

The Idempotency-Key was already used with a different body.

413payload_too_large

JSON bodies may be at most 64 KiB.

429trial_limit

The anonymous trial allows 10 calls per IP per UTC day, shared by REST and MCP. Retry-After gives the seconds left.

500internal_error

The call failed on our side. It is not billed; retry with the same Idempotency-Key.

JSON Schema

Request schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "history": {
      "description": "Complete prior accepted CARF XML, oldest first. For correct, supply the files before previousXml.",
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "xml": {
      "type": "string",
      "minLength": 1
    },
    "filename": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    }
  },
  "required": [
    "xml"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "xml": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><CARF_OECD xmlns=\"urn:oecd:ties:carf:v1\" version=\"1.5\"><MessageSpec><SendingEntityIN>XRCASP000001234</SendingEntityIN><TransmittingCountry>GB</TransmittingCountry><ReceivingCountry>GB</ReceivingCountry><MessageType>CARF</MessageType><MessageRefId>GB2026GB-XRCASP000001234-nil</MessageRefId><MessageTypeIndic>CARF703</MessageTypeIndic><ReportingPeriod>2026-12-31</ReportingPeriod><Timestamp>2027-05-01T09:00:00</Timestamp></MessageSpec></CARF_OECD>",
      "filename": "GB2026GB-XRCASP000001234-nil.xml"
    }
  ]
}
Response schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "valid": {
      "type": "boolean"
    },
    "reportableUsers": {
      "type": "integer",
      "minimum": 0,
      "maximum": 10000
    },
    "errors": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "rule": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "line": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "expected": {
            "type": "string"
          },
          "actual": {
            "type": "string"
          },
          "source": {
            "type": "string"
          }
        },
        "required": [
          "rule",
          "path",
          "expected",
          "actual",
          "source"
        ],
        "additionalProperties": false
      }
    },
    "needsReview": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "rule": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "line": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "expected": {
            "type": "string"
          },
          "actual": {
            "type": "string"
          },
          "source": {
            "type": "string"
          }
        },
        "required": [
          "rule",
          "path",
          "expected",
          "actual",
          "source"
        ],
        "additionalProperties": false
      }
    },
    "schemaVersion": {
      "type": "string",
      "const": "1.5"
    }
  },
  "required": [
    "valid",
    "reportableUsers",
    "errors",
    "needsReview",
    "schemaVersion"
  ],
  "additionalProperties": false
}