# EU E-Invoice (Peppol, XRechnung, Factur-X) API

> Read UBL (Peppol BIS 3, XRechnung), CII and Factur-X / ZUGFeRD PDFs into one EN 16931 JSON, pre-validate business rules, and create UBL or CII from JSON.

- Endpoint: `POST https://apibox.io.vn/v1/eu-einvoice`
- Category: Files
- HTML docs: https://apibox.io.vn/docs/eu-einvoice/ (Vietnamese: https://apibox.io.vn/vi/docs/eu-einvoice/)
- Online tool: https://apibox.io.vn/tools/eu-einvoice/
- Authentication: `Authorization: Bearer <API key>` or `X-API-Key: <API key>` (free key: https://apibox.io.vn/dashboard/#signup)

`action=parse` (or `validate`) takes an XML invoice (`xml`, a `file` or a raw body) or a Factur-X / ZUGFeRD 2.x PDF (the embedded factur-x.xml / zugferd-invoice.xml is extracted). UBL 2.1 Invoice / CreditNote (Peppol BIS Billing 3.0, XRechnung UBL, plain EN 16931) and UN/CEFACT CII (Factur-X / ZUGFeRD profiles MINIMUM to EXTENDED, XRechnung CII) are normalised to one JSON: number, dates, type code, currencies, references, seller / buyer / payee / tax representative (VAT ID, legal ID, electronic address, address, contact), delivery, payment means (IBAN, BIC, card, mandate), document allowances and charges, VAT breakdown, totals and lines (quantity, unit, price, item identifiers, classification, VAT category).

The `validation` block is a pre-validation: our own JavaScript implementation of the main EN 16931 business rules — cardinality rules BR-01…BR-65, the calculation rules BR-CO-10…BR-CO-16 (line sum, allowances, charges, totals, VAT total, amount due), VAT category rules for S, Z, E, AE, K, G, O, L, M (taxable amount and tax per rate, exemption reasons, VAT identifiers), BR-DEC decimals — plus Peppol (PEPPOL-EN16931-R001, R003, R010, R020, R120…) and XRechnung (BR-DE-1…BR-DE-17) profile rules, chosen from the customization ID. It does not run the XSD or the official Schematron (EUPL): confirm with the official validator before going live.

`action=create` builds UBL (`syntax=ubl`, `profile` peppol by default, xrechnung or en16931) or CII (`syntax=cii`, Factur-X EN 16931 / XRechnung) from the same JSON; missing line nets, VAT breakdown and totals are calculated, the result is re-parsed and validated. Send a `pdf` with `syntax=cii` to embed factur-x.xml into it (associated file + XMP metadata; the PDF itself is not converted to PDF/A-3).

## Parameters

| Name | In | Type | Required | Default | Description |
|---|---|---|---|---|---|
| `action` | body|query | string | no | `parse` | `parse`, `validate` (findings only) or `create`. Also as a path: /v1/eu-einvoice/validate. |
| `xml` | body | string | no |  | Invoice XML (UBL or CII). |
| `file` | body | file | no |  | XML file or Factur-X / ZUGFeRD PDF. |
| `invoice` | body | object | no |  | create: invoice JSON (same shape as the parse output). |
| `syntax` | body|query | string | no | `ubl` | create: `ubl` or `cii`. |
| `profile` | body|query | string | no |  | create: `peppol` (UBL default), `xrechnung`, `en16931` (CII default) or `facturx`. |
| `pdf` | body | file | no |  | create with `syntax=cii`: visual invoice PDF to embed factur-x.xml into (returns a PDF). |
| `format` | body|query | string | no |  | create: `xml` returns the raw XML file; `json` with a PDF returns it as base64. |

## Example request

```bash
curl -X POST "https://apibox.io.vn/v1/eu-einvoice" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"action":"create","syntax":"ubl","profile":"peppol","invoice":{"number":"INV-2026-0042","issue_date":"2026-11-11","due_date":"2026-12-11","currency":"EUR","buyer_reference":"PO-778","seller":{"name":"Saigon Software JSC","vat_id":"VN0312345678","electronic_address":{"id":"0312345678","scheme":"9901"},"address":{"line1":"12 Nguyen Hue","city":"Ho Chi Minh City","postcode":"700000","country":"VN"}},"buyer":{"name":"Brussels Retail SA","vat_id":"BE0123456749","electronic_address":{"id":"0123456749","scheme":"0208"},"address":{"line1":"Rue Neuve 1","city":"Brussels","postcode":"1000","country":"BE"}},"payment":{"means_code":"58","accounts":[{"iban":"BE71096123456769"}]},"lines":[{"quantity":10,"unit":"HUR","price":{"net":45},"item":{"name":"Software development","vat_category":"AE","vat_rate":0}}]}}'
```

## Example response

```json
{
  "syntax": "UBL",
  "profile": "peppol-bis-3",
  "totals": {
    "line_net": 450,
    "tax_exclusive": 450,
    "vat": 0,
    "tax_inclusive": 450,
    "payable": 450
  },
  "vat_breakdown": [
    {
      "category": "AE",
      "rate": 0,
      "taxable": 450,
      "tax": 0,
      "exemption_reason": "Reverse charge"
    }
  ],
  "validation": {
    "valid": true,
    "fatal": 0,
    "warnings": 0,
    "note": "Pre-validation: own implementation of the main EN 16931 business rules (BR-xx, BR-CO-xx, VAT category rules, BR-DEC) and Peppol / XRechnung profile rules, without XSD and without the official Schematron. Check with the official validator before go-live.",
    "findings": []
  },
  "xml": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Invoice xmlns=\"urn:oasis:names:specification:ubl:schema:xsd:Invoice-2\" …><cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0</cbc:CustomizationID>…"
}
```

## Use cases

- Vietnamese software and service exporters invoicing Belgian, French or German clients
- Check supplier e-invoices before booking them in accounting
- Show the content of a Factur-X / ZUGFeRD PDF or Peppol UBL file in plain JSON
- Generate Peppol BIS or XRechnung XML from an existing billing system without Java libraries

## FAQ

### Is the validation official?

No. It is a pre-validation written from the public EN 16931 rule descriptions, labelled as such. Use the official validator (or your Peppol access point) for the final check.

### Can it send invoices on the Peppol network?

No. It creates and checks the files; sending needs a certified Peppol access point.

### Which countries does this help with?

Belgium (Peppol B2B from 2026), France (Factur-X / UBL / CII via PDPs from September 2026), Germany (XRechnung / ZUGFeRD) and every Peppol country.
