Skip to content

UK CARF XML for HMRC, built and checked in one call

Send your reportable users and their yearly totals per cryptoasset as JSON. Get OECD CARF XML v1.5 that already passes the OECD schema and HMRC's file rules, plus corrections and deletions that reference the right records, and a validator for files you build yourself.

$0.10/user · 10 free calls a day, no signup · REST and MCP

curl https://api.kanagu.dev/v1/carf/generate \
  -H "Content-Type: application/json" \
  -d '{"rcaspId":"XRCASP000001234","reportingYear":2026,"timestamp":"2027-05-01T09:00:00","messageSuffix":"batch-1","provider":{"party":{"kind":"entity","name":"Bramble Digital Markets Ltd","residenceCountries":["GB"],"tins":[{"value":"08801357","issuedBy":"GB"}],"addresses":[{"country":"GB","city":"London","street":"10 Exchange Road","postCode":"EC2A 1AA"}]},"nexus":"CARF901","docSuffix":"provider"},"users":[{"docSuffix":"user-42","record":{"kind":"individual","firstName":"Avery","lastName":"Carter","birthDate":"1982-06-15","residenceCountries":["GB"],"tins":[{"value":"AB123456C","issuedBy":"GB"}],"addresses":[{"country":"GB","city":"York","postCode":"YO1 1AA"}],"transactions":[{"asset":"Bitcoin","cryptoFiatIn":[{"count":4,"units":"0.02150000","amount":"1450.00","currency":"GBP"}]}]}}]}'
const res = await fetch("https://api.kanagu.dev/v1/carf/generate", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.KANAGU_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "rcaspId": "XRCASP000001234",
    "reportingYear": 2026,
    "timestamp": "2027-05-01T09:00:00",
    "messageSuffix": "batch-1",
    "provider": {
      "party": {
        "kind": "entity",
        "name": "Bramble Digital Markets Ltd",
        "residenceCountries": [
          "GB"
        ],
        "tins": [
          {
            "value": "08801357",
            "issuedBy": "GB"
          }
        ],
        "addresses": [
          {
            "country": "GB",
            "city": "London",
            "street": "10 Exchange Road",
            "postCode": "EC2A 1AA"
          }
        ]
      },
      "nexus": "CARF901",
      "docSuffix": "provider"
    },
    "users": [
      {
        "docSuffix": "user-42",
        "record": {
          "kind": "individual",
          "firstName": "Avery",
          "lastName": "Carter",
          "birthDate": "1982-06-15",
          "residenceCountries": [
            "GB"
          ],
          "tins": [
            {
              "value": "AB123456C",
              "issuedBy": "GB"
            }
          ],
          "addresses": [
            {
              "country": "GB",
              "city": "York",
              "postCode": "YO1 1AA"
            }
          ],
          "transactions": [
            {
              "asset": "Bitcoin",
              "cryptoFiatIn": [
                {
                  "count": 4,
                  "units": "0.02150000",
                  "amount": "1450.00",
                  "currency": "GBP"
                }
              ]
            }
          ]
        }
      }
    ]
  }),
});
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.generate",
    "arguments": {
      "rcaspId": "XRCASP000001234",
      "reportingYear": 2026,
      "timestamp": "2027-05-01T09:00:00",
      "messageSuffix": "batch-1",
      "provider": {
        "party": {
          "kind": "entity",
          "name": "Bramble Digital Markets Ltd",
          "residenceCountries": [
            "GB"
          ],
          "tins": [
            {
              "value": "08801357",
              "issuedBy": "GB"
            }
          ],
          "addresses": [
            {
              "country": "GB",
              "city": "London",
              "street": "10 Exchange Road",
              "postCode": "EC2A 1AA"
            }
          ]
        },
        "nexus": "CARF901",
        "docSuffix": "provider"
      },
      "users": [
        {
          "docSuffix": "user-42",
          "record": {
            "kind": "individual",
            "firstName": "Avery",
            "lastName": "Carter",
            "birthDate": "1982-06-15",
            "residenceCountries": [
              "GB"
            ],
            "tins": [
              {
                "value": "AB123456C",
                "issuedBy": "GB"
              }
            ],
            "addresses": [
              {
                "country": "GB",
                "city": "York",
                "postCode": "YO1 1AA"
              }
            ],
            "transactions": [
              {
                "asset": "Bitcoin",
                "cryptoFiatIn": [
                  {
                    "count": 4,
                    "units": "0.02150000",
                    "amount": "1450.00",
                    "currency": "GBP"
                  }
                ]
              }
            ]
          }
        }
      ]
    }
  }
}

Why

What it solves

From 1 January 2026, UK reporting cryptoasset service providers must collect details of their users and report each reportable user's yearly totals to HMRC. The first report, for calendar 2026, is due by 31 May 2027. HMRC accepts it as OECD CARF XML v1.5, which must pass the OECD schema and HMRC's 44 file rules, with every record carrying a DocRefId that later corrections must reference. A TIN with a wrong check digit or a correction that points at the wrong record sends the file back. Kanagu builds the XML from your data, checks it the way HMRC will, and tells you exactly which value failed.

Built for

  • Crypto exchanges, brokers and custodians that report to HMRC as UK reporting cryptoasset service providers
  • Tax and compliance software that prepares CARF filings for its exchange customers
  • AI agents that assemble a CARF batch and must check it before anyone uploads it
Generate
carf.generate takes your registered RCASP ID, provider details and users with totals per cryptoasset and transaction type: crypto-to-crypto, crypto-to-fiat, transfers, wallet transfers out and retail payments. It returns the XML, the MessageRefId and the filename, and returns the XML only when the file passes every check.
Correct and delete
carf.correct reads the accepted file you send, finds each record by its latest DocRefId and writes replacements (OECD2) or deletions (OECD3) that point at it. Unchanged provider records are carried as OECD0. Pass the earlier accepted files as history and DocRefIds are checked for uniqueness across all of them.
Validate
carf.validate checks XML you built elsewhere against the OECD CARF XSD v1.5, the OECD user guide and HMRC's file rules, then checks TIN formats and check digits and LEI check digits. Each finding names the rule, the XML path and line, what was expected, what it found and the source of the rule.

Example

What goes in, what comes out

In: Your RCASP ID, provider details and users with totals per asset as JSON, or CARF XML to check. Out: OECD CARF XML v1.5 with its filename, or errors and review items with path, line and source.

Request · POST /v1/carf/generate
{
  "rcaspId": "XRCASP000001234",
  "reportingYear": 2026,
  "timestamp": "2027-05-01T09:00:00",
  "messageSuffix": "batch-1",
  "provider": {
    "party": {
      "kind": "entity",
      "name": "Bramble Digital Markets Ltd",
      "residenceCountries": [
        "GB"
      ],
      "tins": [
        {
          "value": "08801357",
          "issuedBy": "GB"
        }
      ],
      "addresses": [
        {
          "country": "GB",
          "city": "London",
          "street": "10 Exchange Road",
          "postCode": "EC2A 1AA"
        }
      ]
    },
    "nexus": "CARF901",
    "docSuffix": "provider"
  },
  "users": [
    {
      "docSuffix": "user-42",
      "record": {
        "kind": "individual",
        "firstName": "Avery",
        "lastName": "Carter",
        "birthDate": "1982-06-15",
        "residenceCountries": [
          "GB"
        ],
        "tins": [
          {
            "value": "AB123456C",
            "issuedBy": "GB"
          }
        ],
        "addresses": [
          {
            "country": "GB",
            "city": "York",
            "postCode": "YO1 1AA"
          }
        ],
        "transactions": [
          {
            "asset": "Bitcoin",
            "cryptoFiatIn": [
              {
                "count": 4,
                "units": "0.02150000",
                "amount": "1450.00",
                "currency": "GBP"
              }
            ]
          }
        ]
      }
    }
  ]
}
Response · 200
{
  "valid": true,
  "reportableUsers": 1,
  "errors": [],
  "needsReview": [],
  "schemaVersion": "1.5",
  "xml": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<CARF_OECD xmlns=\"urn:oecd:ties:carf:v1\" xmlns:stf=\"urn:oecd:ties:carfstf:v5\" version=\"1.5\">\n<MessageSpec><SendingEntityIN>XRCASP000001234</SendingEntityIN><TransmittingCountry>GB</TransmittingCountry><ReceivingCountry>GB</ReceivingCountry><MessageType>CARF</MessageType><MessageRefId>GB2026GB-XRCASP000001234-batch-1</MessageRefId><MessageTypeIndic>CARF701</MessageTypeIndic><ReportingPeriod>2026-12-31</ReportingPeriod><Timestamp>2027-05-01T09:00:00</Timestamp></MessageSpec>\n<CARFBody>\n<RCASP><RCASP_ID><Entity><ResCountryCode>GB</ResCountryCode><TIN issuedBy=\"GB\">08801357</TIN><Name>Bramble Digital Markets Ltd</Name><Address><CountryCode>GB</CountryCode><AddressFix><Street>10 Exchange Road</Street><PostCode>EC2A 1AA</PostCode><City>London</City></AddressFix></Address></Entity></RCASP_ID><Nexus>CARF901</Nexus><DocSpec><stf:DocTypeIndic>OECD1</stf:DocTypeIndic><stf:DocRefId>GB2026GB-XRCASP000001234-batch-1-provider</stf:DocRefId></DocSpec></RCASP>\n<CryptoUsers><UserID><Individual><ResCountryCode>GB</ResCountryCode><TIN issuedBy=\"GB\">AB123456C</TIN><Name><FirstName>Avery</FirstName><LastName>Carter</LastName></Name><Address><CountryCode>GB</CountryCode><AddressFix><PostCode>YO1 1AA</PostCode><City>York</City></AddressFix></Address><BirthInfo><BirthDate>1982-06-15</BirthDate></BirthInfo></Individual></UserID><RelevantTransactions><CryptoAsset>Bitcoin</CryptoAsset><CryptoFiatIn><NumberofTransactions>4</NumberofTransactions><Amount currCode=\"GBP\">1450.00</Amount><NumberofUnits>0.02150000</NumberofUnits></CryptoFiatIn></RelevantTransactions><DocSpec><stf:DocTypeIndic>OECD1</stf:DocTypeIndic><stf:DocRefId>GB2026GB-XRCASP000001234-batch-1-user-42</stf:DocRefId></DocSpec></CryptoUsers>\n</CARFBody>\n</CARF_OECD>",
  "filename": "GB2026GB-XRCASP000001234-batch-1.xml",
  "messageRefId": "GB2026GB-XRCASP000001234-batch-1"
}

One UK resident bought £1,450.00 of Bitcoin in four trades during 2026. The provider record and the user record get DocRefIds built from the MessageRefId and your docSuffix, and the filename is the one HMRC expects. One reportable user in a valid file costs $0.10.

Try it

Run it on the live API

The sample reports one user who bought Bitcoin. Change the user's TIN to 1234567890 and the call returns a tin.checksum error on line 6 with no XML.

$0.10/user

No key needed · 10 free calls per IP per day

Response

Run the request to see the live response here.

Reference

Operations

OperationPrice
carf.correct

Build a UK CARF XML v1.5 correction from prior accepted XML and replacement or deletion records. Up to 10,000 users.

$0.10/user
carf.generate

Build UK HMRC CARF XML v1.5 from reportable users and transaction totals. Up to 10,000 users.

$0.10/user
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.

$0.10/user
curl https://api.kanagu.dev/v1/carf/generate \
  -H "Authorization: Bearer $KANAGU_KEY" \
  -H "Content-Type: application/json" \
  -d '{"rcaspId":"XRCASP000001234","reportingYear":2026,"timestamp":"2027-05-01T09:00:00","messageSuffix":"batch-1","provider":{"party":{"kind":"entity","name":"Bramble Digital Markets Ltd","residenceCountries":["GB"],"tins":[{"value":"08801357","issuedBy":"GB"}],"addresses":[{"country":"GB","city":"London","street":"10 Exchange Road","postCode":"EC2A 1AA"}]},"nexus":"CARF901","docSuffix":"provider"},"users":[{"docSuffix":"user-42","record":{"kind":"individual","firstName":"Avery","lastName":"Carter","birthDate":"1982-06-15","residenceCountries":["GB"],"tins":[{"value":"AB123456C","issuedBy":"GB"}],"addresses":[{"country":"GB","city":"York","postCode":"YO1 1AA"}],"transactions":[{"asset":"Bitcoin","cryptoFiatIn":[{"count":4,"units":"0.02150000","amount":"1450.00","currency":"GBP"}]}]}}]}'
const res = await fetch("https://api.kanagu.dev/v1/carf/generate", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.KANAGU_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "rcaspId": "XRCASP000001234",
    "reportingYear": 2026,
    "timestamp": "2027-05-01T09:00:00",
    "messageSuffix": "batch-1",
    "provider": {
      "party": {
        "kind": "entity",
        "name": "Bramble Digital Markets Ltd",
        "residenceCountries": [
          "GB"
        ],
        "tins": [
          {
            "value": "08801357",
            "issuedBy": "GB"
          }
        ],
        "addresses": [
          {
            "country": "GB",
            "city": "London",
            "street": "10 Exchange Road",
            "postCode": "EC2A 1AA"
          }
        ]
      },
      "nexus": "CARF901",
      "docSuffix": "provider"
    },
    "users": [
      {
        "docSuffix": "user-42",
        "record": {
          "kind": "individual",
          "firstName": "Avery",
          "lastName": "Carter",
          "birthDate": "1982-06-15",
          "residenceCountries": [
            "GB"
          ],
          "tins": [
            {
              "value": "AB123456C",
              "issuedBy": "GB"
            }
          ],
          "addresses": [
            {
              "country": "GB",
              "city": "York",
              "postCode": "YO1 1AA"
            }
          ],
          "transactions": [
            {
              "asset": "Bitcoin",
              "cryptoFiatIn": [
                {
                  "count": 4,
                  "units": "0.02150000",
                  "amount": "1450.00",
                  "currency": "GBP"
                }
              ]
            }
          ]
        }
      }
    ]
  }),
});
if (!res.ok) throw new Error((await res.json()).error.message);
const result = await res.json();
claude mcp add --transport http kanagu https://api.kanagu.dev/mcp \
  --header "Authorization: Bearer $KANAGU_KEY"
{
  "mcpServers": {
    "kanagu": {
      "url": "https://api.kanagu.dev/mcp",
      "headers": {
        "Authorization": "Bearer ${env:KANAGU_KEY}"
      }
    }
  }
}
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "carf.generate",
    "arguments": {
      "rcaspId": "XRCASP000001234",
      "reportingYear": 2026,
      "timestamp": "2027-05-01T09:00:00",
      "messageSuffix": "batch-1",
      "provider": {
        "party": {
          "kind": "entity",
          "name": "Bramble Digital Markets Ltd",
          "residenceCountries": [
            "GB"
          ],
          "tins": [
            {
              "value": "08801357",
              "issuedBy": "GB"
            }
          ],
          "addresses": [
            {
              "country": "GB",
              "city": "London",
              "street": "10 Exchange Road",
              "postCode": "EC2A 1AA"
            }
          ]
        },
        "nexus": "CARF901",
        "docSuffix": "provider"
      },
      "users": [
        {
          "docSuffix": "user-42",
          "record": {
            "kind": "individual",
            "firstName": "Avery",
            "lastName": "Carter",
            "birthDate": "1982-06-15",
            "residenceCountries": [
              "GB"
            ],
            "tins": [
              {
                "value": "AB123456C",
                "issuedBy": "GB"
              }
            ],
            "addresses": [
              {
                "country": "GB",
                "city": "York",
                "postCode": "YO1 1AA"
              }
            ],
            "transactions": [
              {
                "asset": "Bitcoin",
                "cryptoFiatIn": [
                  {
                    "count": 4,
                    "units": "0.02150000",
                    "amount": "1450.00",
                    "currency": "GBP"
                  }
                ]
              }
            ]
          }
        }
      ]
    }
  }
}

Every field, error and schema is in the carf.generate reference.

Coverage

Limits and coverage

Jurisdiction
UK domestic submissions to HMRC: new data (CARF701), corrections and deletions (CARF702) and nil reports (CARF703, validate only)
Rules
OECD CARF XML schema v1.5 (July 2025) and its user guide, and HMRC's CARF file requirements of 2 November 2026
TIN check digits
GB (UTR, plus NINO and company registration number formats), FR (SPI, SIREN, SIRET), DE (IdNr for individuals), JP (Individual Number, Corporate Number) and CA (SIN or individual tax number, BN). LEI check digits for every country.
Other TINs
Format not checked. Each one comes back in needsReview with a link to the OECD TIN directory, so a person can confirm it.
Not covered
RCASP registration, user due diligence and self-certification, valuing transactions in fiat, uploading the file to HMRC, and CARF or DAC8 filings in other countries
Limits
10,000 reportable users and 16 MiB of JSON per request. Split larger populations into batches with their own messageSuffix.
Data
Inputs are processed in memory. XML checks run in Kanagu's own validator container in the EU, with internet access turned off. Results are not stored: a retry with the same Idempotency-Key recomputes the result, so names and TINs stay out of Kanagu's database.

The UK timeline

  • 1 January 2026

    UK reporting cryptoasset service providers start collecting user details and transaction data.

  • 31 May 2027

    First report to HMRC, covering calendar 2026.

  • Every 31 May after

    The report for the previous calendar year.

Source: HMRC, Reporting cryptoasset user and transaction data.

Fields of each finding

rule
What failed, e.g. tin.checksum, HMRC.34 (a file rule by its number), OECD.tin_residence or an xsd. schema error.
path
Where in the XML, e.g. /CARF_OECD/CARFBody/CryptoUsers/UserID/Individual/TIN, or the JSON field for a correction reference.
line
The line in the XML, when there is one.
expected
What the rule requires, e.g. TIN with a valid check digit.
actual
The value it found, e.g. 1234567890.
source
The document the rule comes from: the OECD user guide, HMRC's file requirements or the published check-digit algorithm.

Compare

Compared with the usual approaches

Ways teams usually produce a CARF file:

ApproachWhat you take on
Build the XML in houseMap your user data onto the OECD schema, implement HMRC's 44 file rules and each country's TIN check digits, and track every DocRefId you have ever filed.
Upload to HMRC and fix what bouncesLearn about a wrong check digit or a bad DocRefId only when HMRC rejects the file, close to the 31 May deadline.
KanaguOne call per batch returns a file that already passes the schema, the HMRC rules and the TIN checks, with every finding pointing at the value to fix, at $0.10 per reportable user.

Pricing

$0.10/user, billed only on success

$1 of usage free every month after sign-in. Then pay as you go with no monthly fee, or the $9/month Bundle with $9 of usage included, shared across every Kanagu product. Compare plans

Sign in, create a key and use $1 of calls free each month, no card needed. Subscribe from your dashboard when you need more. Polar is the merchant of record and handles payment, tax and invoices.

10 free calls a day
Start without a key
Try every call above for free. When it works, sign in for a key with $1 of usage free every month.

FAQ

UK CARF questions

Which users count towards the price?
Reportable users in the result. carf.generate and carf.correct bill only when the XML comes back, so a rejected batch costs nothing. carf.validate bills every user in a file that passes the XSD, including files with HMRC findings, because that is when the rule checks run. A nil report has no users and is free.
What happens to a TIN from a country you don't check?
It goes into the file, and the response lists it in needsReview as tin.format_unchecked with the OECD TIN directory link. needsReview items do not make the file invalid. The same list flags Canadian missing-TIN placeholders and whitespace inside a submitted TIN.
How are DocRefIds and filenames built?
The MessageRefId is GB, the reporting year, GB, your RCASP ID and your messageSuffix, e.g. GB2026GB-XRCASP000001234-batch-1. Each record's DocRefId is the MessageRefId plus its docSuffix, and the filename is the MessageRefId with .xml. Keep the DocRefIds HMRC accepted: corrections refer to them.
Does Kanagu know what I filed before?
No. Send the accepted XML you are correcting as previousXml and the earlier accepted files as history, oldest first. Kanagu then checks DocRefIds and corrections against them. Without history, confirm earlier submissions with HMRC yourself.
Does Kanagu submit the file to HMRC?
No. You upload the returned XML under the returned filename through HMRC's service, using your own registration.

More APIs with the same key