EN 16931 validator (UBL and CII) API
Check a UBL or CII invoice against the European e-invoicing standard EN 16931 with CEN's official rules.
POST https://api.curatedapi.com/v1/validate/einvoice/en16931
- Version 1
- MCP tool
validate_einvoice_en16931 - Overview
Runs the UBL 2.1 or UN/CEFACT CII D16B schema and then CEN/TC 434's own validation artefacts: the business rules (BR-…), calculation rules (BR-CO-…), VAT rules and code lists of EN 16931-1. The syntax is detected from the document. Country rules (CIUS) such as XRechnung or Peppol BIS are separate endpoints.
Inputs
An invoice that breaks a rule still gets HTTP 200, with "valid": false and the findings (see e-invoice validation).
| Input | Type | Description |
|---|---|---|
xml required |
string | The invoice XML, as text. |
Result
Under result in the answer, next to validator and rules (the official artefacts used, with their versions).
| Result | Type | Description |
|---|---|---|
valid | boolean | true when the document matched a scenario and no check reported an error. |
scenario | ['string', 'null'] | Which set of rules applied, chosen from the document's own type and specification ID; null when none applies. |
document_type | ['string', 'null'] | UBL Invoice, UBL CreditNote or UN/CEFACT CII. |
specification_id | ['string', 'null'] | The CustomizationID (UBL) or guideline ID (CII), BT-24, as found. |
errors | integer | Messages at level error. |
warnings | integer | Messages at level warning. |
notices | integer | Messages at level information. |
error_rules | list of string | The distinct rules that reported an error, sorted. |
checks | list of object | Each check in the order it ran, and whether it passed (a schema failure skips the rules, as in KoSIT's validator). |
messages | list of object | Up to 500 findings. |
messages_truncated | boolean |
Examples
An official sample (cen-ubl-tc434-creditnote1.xml)
jq -Rs '{xml: .}' cen-ubl-tc434-creditnote1.xml |
curl https://api.curatedapi.com/v1/validate/einvoice/en16931 \
-H "Authorization: Bearer $CURATEDAPI_KEY" \
-H "Content-Type: application/json" \
--data-binary @-
{
"validator": "einvoice/en16931@1",
"result": {
"valid": true,
"scenario": "EN 16931 (UBL CreditNote)",
"document_type": "UBL CreditNote",
"specification_id": "urn:cen.eu:en16931:2017",
"errors": 0,
"warnings": 0,
"notices": 0,
"error_rules": [],
"checks": [
{
"check": "XML syntax",
"passed": true
},
{
"check": "UBL 2.1 CreditNote schema",
"passed": true
},
{
"check": "EN 16931 rules 1.3.17",
"passed": true
}
],
"messages": [],
"messages_truncated": false
},
"rules": [
{
"name": "CEN/TC 434 EN 16931 validation artefacts",
"version": "1.3.17",
"url": "https://github.com/ConnectingEurope/eInvoicing-EN16931/releases/tag/validation-1.3.17"
}
]
}
Rules used
- CEN/TC 434 EN 16931 validation artefacts, version 1.3.17
A check shows whether the invoice passes the official rule sets listed, at the versions listed. It is not legal or tax advice, and passing does not promise that a tax authority or buyer will accept the invoice. See the terms.
Errors share one format; see errors. Billing, retries and batches work the same for every endpoint.