# Document Formats & Identifiers API
> Validate EN 16931 e-invoices and FHIR JSON, parse passport/ID MRZ check digits and EPC/Swiss QR-bill payloads, extract PDF tables, and decode barcodes — pure computation on caller input plus vendored schemas.
Each paid operation uses a fixed USDC price on Base with the x402 exact scheme. Unpaid GET, HEAD, and POST return 402 payment terms (POST validates the body only after payment terms are satisfied). A request that carries payment-signature is not yet charged: settlement happens only after a successful (2xx) result. HTTP 4xx/5xx are not charged. Coverage bodies with status complete, partial, or failed all return HTTP 200 and are charged at the full listed price. Settled 2xx responses include a payment-response header; 4xx/5xx do not.
Follow https://www.brainiac.software/agent-instructions.txt for install, payment pins, idempotency, and billing rules.
- Product: https://www.brainiac.software/api/document-formats
- Docs: https://www.brainiac.software/api/document-formats/docs
- OpenAPI: https://www.brainiac.software/api/document-formats/openapi.json
- Contact: support@brainiac.software (https://www.brainiac.software/contact)
## Operations
### POST /api/v1/document-formats/en16931-invoice-validate
$0.05 USDC. Validate UBL or CII e-invoices against CEN EN 16931 artefacts 1.3.17 (and UBL 2.1 XSD).
Inputs: xml?, pdfBase64?, syntax?
Docs: https://www.brainiac.software/api/document-formats/docs#document-formats-en16931-invoice-validate
Example request:
```json
{
"xml": "12115118"
}
```
Example response:
```json
{
"valid": false,
"syntax": "UBL-Invoice",
"customizationId": "urn:cen.eu:en16931:2017",
"documentId": "12115118",
"xsd": {
"checked": true,
"errors": []
},
"rules": {
"artefactVersion": "1.3.17",
"fatal": [],
"warnings": []
},
"notes": [],
"sources": [
{
"source": "CEN/TC 434 EN 16931 validation artefacts 1.3.17 (EUPL 1.2)",
"url": "https://github.com/ConnectingEurope/eInvoicing-EN16931/releases/tag/validation-1.3.17",
"retrievedAt": "2026-10-12",
"status": "ok"
}
],
"limitations": [
"XSD + CEN business rules only; Peppol BIS / XRechnung / Factur-X profile rules are not applied."
]
}
```
### POST /api/v1/document-formats/fhir-resource-validate
$0.02 USDC. Validate a FHIR resource against the official HL7 JSON Schema for R4 or R5.
Inputs: resource, version?
Docs: https://www.brainiac.software/api/document-formats/docs#document-formats-fhir-resource-validate
Example request:
```json
{
"version": "R4",
"resource": {
"resourceType": "Patient",
"id": "example",
"gender": "mail",
"birthDate": "1974-13-25",
"foo": 1
}
}
```
Example response:
```json
{
"valid": false,
"version": "R4",
"resourceType": "Patient",
"errors": [
{
"path": "gender",
"keyword": "enum",
"message": "must be equal to one of the allowed values"
}
],
"sources": [
{
"source": "HL7 FHIR JSON Schema R4",
"url": "https://hl7.org/fhir/R4/fhir.schema.json.zip",
"retrievedAt": "2026-11-14",
"status": "ok"
}
],
"limitations": [
"Schema validation only."
]
}
```
### POST /api/v1/document-formats/mrz-parse-checkdigits
$0.01 USDC. Parse TD1/TD2/TD3 machine-readable zones and verify ICAO Doc 9303 check digits.
Inputs: mrz
Docs: https://www.brainiac.software/api/document-formats/docs#document-formats-mrz-parse-checkdigits
Example request:
```json
{
"mrz": [
"P