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.
https://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.validateathttps://api.kanagu.dev/mcp- Markdown
- /docs/carf.validate.md
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"
}
}
}{
"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.
xmlstringrequiredfilenamestring (max 255 chars)
Response
200 · application/json
validbooleanrequiredreportableUsersinteger (0 to 10000)requirederrorsarray of objectrequirederrors[].rulestringrequirederrors[].pathstringrequirederrors[].lineinteger (≤ 9007199254740991)errors[].expectedstringrequirederrors[].actualstringrequirederrors[].sourcestringrequiredneedsReviewarray of objectrequiredneedsReview[].rulestringrequiredneedsReview[].pathstringrequiredneedsReview[].lineinteger (≤ 9007199254740991)needsReview[].expectedstringrequiredneedsReview[].actualstringrequiredneedsReview[].sourcestringrequiredschemaVersion"1.5"required
Try it
Errors
Errors are JSON {"error":{"code","message"}}. An operation may add its own 400 codes; the message says what to fix.
| Status | Code and meaning |
|---|---|
| 400 | invalid_inputThe body does not match the request schema. The message names each field. |
| 400 | invalid_jsonThe body is missing or is not valid JSON. |
| 400 | invalid_idempotency_keyIdempotency-Key must be 1–128 visible ASCII characters. |
| 401 | invalid_api_keyThe Bearer key is missing, malformed, invalid or inactive. |
| 402 | free_allowance_exhaustedThis 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_foundNo operation at this path. |
| 409 | idempotency_conflictThe Idempotency-Key was already used with a different body. |
| 413 | payload_too_largeJSON bodies may be at most 64 KiB. |
| 429 | trial_limitThe anonymous trial allows 10 calls per IP per UTC day, shared by REST and MCP. Retry-After gives the seconds left. |
| 500 | internal_errorThe 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
}