eliDocs
API Reference

POST /v1/generate

POST/v1/generate

Generate a compliant e-invoice from structured invoice data — EN 16931 (UBL/CII) formats, Peppol, hybrid PDF, or Italy FatturaPA FPR12 XML.

Create an e-invoice from JSON data in one API call.

Before Beliq returns the result, it validates your invoice against the rules that apply to the chosen standard. For EN 16931–based formats that means XSD, EN 16931 Schematron, and CIUS/profile Schematron where applicable. For Italy FatturaPA (standard: "fatturapa") validation is authority XSD only (no EN 16931 Schematron layer). If validation fails, you get a 422 INVALID_INVOICE response with details.

Quick copy examples

Generate XML:

generate-xml.sh
curl -X POST https://api.beliq.eu/v1/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "standard": "xrechnung",
    "profile": "en16931",
    "output": "xml",
    "invoice": { ... }
  }'

Generate PDF:

generate-pdf.sh
curl -X POST https://api.beliq.eu/v1/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "standard": "zugferd",
    "profile": "en16931",
    "output": "pdf",
    "invoice": { ... }
  }' \
  --output invoice.pdf

Request

POST /v1/generate
Content-Type: application/json
Authorization: Bearer <api-key>

Request body

Field Type Required Description
standard string required E-invoice standard. One of: xrechnung, zugferd, facturx, peppol-bis, fatturapa (Italy FatturaPA ordinaria FPR12 XML), facturae (Spain Facturae 3.2.2 XML), eslog (Slovenia e-SLOG 2.0 XML); the three national formats use XSD validation only, not EN 16931 UBL/CII
profile string optional Compliance profile. One of: minimum, basicwl, basic, en16931, extended, extended-ctc-fr, xrechnung, peppol, romania-ro-cius (with standard: "peppol-bis" for Romania RO_CIUS, see Romania format reference), ordinaria (with standard: "fatturapa" or "facturae"), eracun (with standard: "eslog", see Slovenia e-SLOG format reference). If omitted, Beliq uses the default for the chosen standard (xrechnung for xrechnung, peppol for peppol-bis, ordinaria for fatturapa and facturae, eracun for eslog, en16931 for zugferd/facturx).
output string required Output format. xml for raw XML, or pdf. For ZUGFeRD / Factur-X, pdf is a hybrid PDF/A-3 with embedded XML; for the XML-only standards (xrechnung, peppol-bis, fatturapa, facturae, eslog), pdf is a visualization PDF and requires a template or pdfTemplateId.
invoice object required Invoice data (see Invoice object below)
verify boolean optional When true (default), the engine validates output before returning it. Set false to skip post-generation validation (not recommended).
template string optional Set to "standard" to render the built-in styled invoice layout for pdf output. Required to get a visualization PDF from an XML-only standard; for ZUGFeRD / Factur-X it styles the hybrid’s visible page (omit it for a blank page). See Styling the PDF.
pdfTemplateId string optional Render the PDF from one of your stored custom templates, designed in the dashboard. The value is the template’s short ref (a k3d-9mp-style code shown next to it in the dashboard), not a raw UUID. Takes precedence over template. Requires an authenticated request (the template is org-scoped). Honoured for any pdf output.

Standard and output combinations

PDF output comes in two kinds. ZUGFeRD / Factur-X produce a hybrid PDF/A-3 with the legal XML embedded inside it. The XML-only standards have no hybrid form, so a PDF request returns a visualization PDF — a human-readable rendering of the same validated invoice, with no embedded XML (the legal artifact stays the XML; request it with output: "xml"). A visualization PDF requires a template or pdfTemplateId. The response’s x-pdf-kind header tells you which you received.

Standard XML output PDF output XML syntax
xrechnung UBL 2.1 or CII D16B Visualization PDF (needs template) CII (default) or UBL
zugferd CII D22B Hybrid PDF/A-3 with embedded CII XML CII (D22B, ZUGFeRD 2.x)
facturx CII D22B Hybrid PDF/A-3 with embedded CII XML CII (D22B, Factur-X 1.08)
peppol-bis UBL 2.1 Visualization PDF (needs template) UBL
fatturapa FPR12 (Italy FatturaPA ordinaria XML) Visualization PDF (needs template) Authority XSD graph — not EN 16931 UBL/CII
facturae Facturae 3.2.2 (Spain ordinaria XML) Visualization PDF (needs template) Authority XSD graph — not EN 16931 UBL/CII
eslog e-SLOG 2.0 (Slovenia eracun XML) Visualization PDF (needs template) Authority XSD graph, not EN 16931 UBL/CII

Invoice object

Field Type Required Constraints Description
number string required 1–200 chars Invoice / credit-note number
issueDate string required YYYY-MM-DD Issue date
dueDate string optional YYYY-MM-DD Payment due date
currencyCode string required 3 chars (ISO 4217) Currency code, e.g. EUR
documentType string optional "invoice" (default) or "creditnote" Discriminates between an Invoice and a CreditNote. Supported when standard accepts CreditNote payloads: peppol-bis, facturx, xrechnung, zugferd, and eslog (e-SLOG emits document type code 381 in S_BGM). fatturapa and facturae accept invoices only — use documentType: "invoice" or omit the field. See DOCUMENT_TYPE_STANDARD_MISMATCH, the format overview, and Peppol Credit notes.
precedingInvoiceReference object strongly recommended on every CreditNote — see notes id: 1–200 chars (the original invoice’s number); issueDate (optional): YYYY-MM-DD Reference to the original invoice this credit note corrects. Emitted as UBL cac:BillingReference / cac:InvoiceDocumentReference on UBL outputs (Peppol BIS, XRechnung-UBL) or CII ram:InvoiceReferencedDocument on CII outputs (XRechnung-CII, ZUGFeRD, Factur-X). The UBL CreditNote builder fails closed without id; the CII CreditNote builder fails closed if the block is supplied without an id. EN 16931 BR-55 requires the link on every credit note, so verify: true (the default) will reject CreditNote output that omits it on every CreditNote-capable standard.
buyerReference string optional Max 200 chars Buyer’s reference (required for XRechnung B2G)
orderReference string optional Max 200 chars Purchase order reference
note string optional Max 5000 chars Free-text note
seller Party required Seller/supplier details. For standard: "peppol-bis", must include either peppol or a vatId + supported address.countryCode so Beliq can derive the Peppol electronic-address.
buyer Party required Buyer/customer details. Same Peppol requirement as seller.
lines InvoiceLine[] required Min 1 item Invoice line items
taxSummary TaxSummary[] optional VAT summary per category
paymentMeans PaymentMeans optional Payment method details
paymentTerms string optional Max 500 chars Payment terms description
totalNetAmount number required Total excluding VAT
totalTaxAmount number required Total VAT amount
totalGrossAmount number required Total including VAT
franceCtc boolean optional Opt-in for the French B2B reform CTC overlay on CII (Factur-X). Ignored for fatturapa.
businessProcessId string optional S8, B8, or M8 Flux 2 BusinessProcess code; only used when franceCtc is true.
italy object optional Italy FatturaPA routing and document defaults when standard is "fatturapa". See Italy (FatturaPA) fields.
spain object optional Spain Facturae routing and document defaults when standard is "facturae". See Spain (Facturae) fields.
slovenia object optional Slovenia e-SLOG namespace when standard is "eslog". Intentionally empty today; reserved for future Slovenia-specific fields.

Italy (FatturaPA) fields

Use the optional invoice.italy object with standard: "fatturapa" and profile: "ordinaria" (or omit profile — it defaults to ordinaria). Fields are forwarded to the engine and should follow the official formato FatturaPA documentation.

Field Type Description
codiceDestinatario string SDI routing code (typically 7 characters; use 0000000 for PEC-based routing per your process).
regimeFiscale string Seller fiscal regime code (e.g. RF01, RF19).
progressivoInvio string Transmission progressive id (e.g. 00001).
idTrasmittente object Optional { "country": "IT", "id": "..." } VAT override; defaults from seller vatId when omitted.
tipoDocumento string Document type code (e.g. TD01).
condizioniPagamento string Payment terms code (TP01 / TP02).
modalitaPagamento string Payment means code (e.g. MP01, MP05).
esigibilitaIVA string VAT chargeability (e.g. I).
causale string[] Optional Causale lines on the Italian document.

For Italian addresses, use seller.address.region / buyer.address.region (or province) for the Provincia code when present in your data (2–3 characters).

Spain (Facturae) fields

Use the optional invoice.spain object with standard: "facturae" and profile: "ordinaria" (or omit profile — it defaults to ordinaria). All fields are optional with MINECO-aligned defaults; fields are forwarded to the engine and should follow the official Facturae format documentation.

Field Type Description
modality string Batch mode: I single invoice (default) or L list.
invoiceIssuerType string Issuer perspective: EM emitter (default), RE receiver, TE third-party.
invoiceDocumentType string Document type code, e.g. FC complete (default), FA simplified, AF self-billed.
invoiceClass string Invoice class code, e.g. OO original (default).
taxTypeCode string Tax type code, e.g. 01 IVA (default), 02 IPSI, 03 IGIC.
languageName string ISO 639-1 language code, e.g. es (default), en, ca, eu, gl.
batchIdentifier string Batch identifier; defaults to BELIQ-{invoice.number}.
seller / buyer object Optional per-party overrides: { "personTypeCode": "J" | "F", "residenceTypeCode": "R" | "U" | "E" }. Auto-derived from the party VAT and address country when omitted.

Provide Spanish-resident party vatId as a NIF/CIF (9 characters, optional ES prefix). PersonTypeCode (J legal / F natural) and ResidenceTypeCode (R Spain / U EU·EEA / E third country) are auto-derived; resident parties emit an AddressInSpain block, non-residents an OverseasAddress.

Party object

Field Type Required Constraints Description
name string required 1–200 chars Legal name
vatId string optional 2-letter country prefix + 2–18 alphanumeric chars VAT identification number, e.g. DE123456789
taxId string optional Max 30 chars Tax registration number
registrationId string optional Max 50 chars Company registration number
email string optional Max 254 chars, valid email Email address (required for XRechnung)
phone string optional Max 30 chars Phone number
address Address required Postal address
contactName string optional Max 200 chars Contact person name
peppol PeppolEndpoint optional Peppol electronic-address. Required for standard: "peppol-bis" if Beliq cannot derive one from vatId + country.

Peppol endpoint object

For Peppol BIS Billing 3.0, every party needs an electronic-address that uniquely identifies it on the Peppol Network.

Field Type Required Description
schemeId string required Peppol EAS code (e.g. 9930 for German VAT, 9957 for French VAT, 0184 for Danish DK:CVR). See the official EAS code list.
id string required The actual identifier under that scheme (often the VAT number, sometimes a national company-registry number).

Address object

Field Type Required Constraints Description
street string optional Max 500 chars Street and house number
additionalStreet string optional Max 500 chars Additional address line
city string required Max 200 chars City
postalCode string required Max 20 chars Postal/ZIP code
countryCode string required 2 chars (ISO 3166-1 alpha-2) Country code, e.g. DE
state string optional Max 200 chars State or province (generic)
region string optional 2–3 chars Italian provincia / region code; used for FatturaPA Provincia.
province string optional 2–3 chars Alias for region when mapping Italian addresses.

Invoice line object

Field Type Required Constraints Description
description string required 1–1000 chars Item description
quantity number required > 0 Quantity
unitCode string required 1–10 chars UN/ECE Recommendation 20 unit code (e.g. HUR for hours, C62 for units)
unitPrice number required ≥ 0 Price per unit
lineTotal number required Line total (quantity × unitPrice)
vatRate number required 0–100 VAT rate as percentage
vatCategoryCode string required 1–10 chars VAT category code (e.g. S for standard rate)
itemId string optional Max 50 chars Seller’s item identifier
buyerItemId string optional Max 50 chars Buyer’s item identifier

Tax summary object

Field Type Required Constraints Description
vatCategoryCode string required 1–10 chars VAT category code
vatRate number required 0–100 VAT rate as percentage
taxableAmount number required Taxable amount for this category
taxAmount number required Tax amount for this category

Payment means object

Field Type Required Constraints Description
typeCode string required 1–10 chars UNTDID 4461 payment means code (e.g. 30 for credit transfer, 58 for SEPA)
iban string optional Max 34 chars IBAN
bic string optional Max 11 chars BIC/SWIFT code
bankName string optional Max 200 chars Bank name
paymentReference string optional Max 200 chars Payment reference / remittance information

Response

XML output (output: "xml")

When output is "xml", the response body is XML. Response headers may include x-schematron-version for EN 16931–based formats; FatturaPA responses are validated against the authority XSD graph only (see validation artifacts). The X-Version-Block response header (compact JSON) carries the full set of artifact versions in play — the same fields as the POST /v1/validate body, minus the ruleset-selection fields (rulesetChannel, rulesetFellBack), since generate always uses the current bundled artifacts and does not support Beliq-Ruleset pinning.

<?xml version="1.0" encoding="UTF-8"?>
<rsm:CrossIndustryInvoice xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100" ...>
  ...
</rsm:CrossIndustryInvoice>

PDF output (output: "pdf")

When output is "pdf", the response body is a PDF. The x-pdf-kind response header tells you which kind you received:

HTTP/1.1 200 OK
Content-Type: application/pdf
x-pdf-kind: hybrid
x-schematron-version: 1.3.16
  • x-pdf-kind: hybrid (ZUGFeRD / Factur-X) — a PDF/A-3 file with the legal invoice XML embedded inside it for system processing. This is the compliance artifact.
  • x-pdf-kind: visualization (XML-only standards) — a human-readable rendering of the invoice with no embedded XML. It is a convenience view, not a compliance artifact; fetch the legal document separately with output: "xml". Returned only when you supply a template or pdfTemplateId.

Styling the PDF

By default a hybrid PDF carries a blank visible page (the XML is what matters). To render a styled, human-readable invoice page, opt in with one of:

  • template: "standard" — Beliq’s built-in invoice layout. This is also what the free generator uses. For XML-only standards it is required to produce a visualization PDF.
  • pdfTemplateId: "k3d-9mp" — one of your own PDF templates, designed visually in the dashboard (logo, colours, fonts, layout). The value is the template’s short ref, shown next to it in the dashboard. Org-scoped, so the request must be authenticated; takes precedence over template. See the PDF template errors for the reference failures.

In every case the invoice data (parties, lines, totals) is bound by Beliq from the invoice you sent — the template only controls presentation, so the visible page can never disagree with the embedded XML.

generate-pdf-styled.sh
curl -X POST https://api.beliq.eu/v1/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "standard": "facturx",
    "output": "pdf",
    "template": "standard",
    "invoice": { ... }
  }' \
  --output invoice.pdf

JSON envelope (fallback)

In some cases (for example when the upstream engine returns a JSON wrapper), the response is a JSON envelope. The data.format field mirrors the invoice syntax: "cii" for CII, "ubl" for Peppol/XRechnung UBL, or "fatturapa" for Italy FPR12.

{
  "success": true,
  "data": {
    "invoiceId": "",
    "format": "cii",
    "standard": "xrechnung",
    "profile": "en16931",
    "validationResult": {
      "valid": true,
      "format": "cii",
      "schematronVersion": "1.3.16",
      "errors": [],
      "warnings": []
    }
  }
}

Error responses

HTTP Status Error Code When
400 VALIDATION_ERROR Request body fails JSON schema validation (missing fields, wrong types, constraint violations)
400 UNSUPPORTED_FORMAT Requested standard/profile/output combination is not supported
422 INVALID_INVOICE Invoice data is structurally valid but fails validation (EN 16931 / CIUS Schematron for UBL/CII, or authority XSD for fatturapa)
422 PROFILE_STANDARD_MISMATCH The chosen profile is not allowed for the chosen standard (for example profile: "extended" with standard: "peppol-bis"). The error details includes standard, profile, and allowedProfiles.
422 DOCUMENT_TYPE_STANDARD_MISMATCH documentType: "creditnote" with a standard that does not accept CreditNote payloads (for example fatturapa). details: standard, documentType, creditNoteCapableStandards.
400 PDF_TEMPLATE_AUTH_REQUIRED pdfTemplateId was sent on an unauthenticated request (stored templates are org-scoped). Use your API key, or template: "standard".
404 PDF_TEMPLATE_NOT_FOUND The referenced pdfTemplateId does not exist in your organization.
422 PDF_TEMPLATE_INVALID The stored template definition could not be parsed. Re-save it in the dashboard designer.
503 ENGINE_UNAVAILABLE The validation engine is temporarily unavailable

422 INVALID_INVOICE example

When business rule validation fails, the error includes the full validation result in details:

{
  "success": false,
  "error": {
    "code": "INVALID_INVOICE",
    "message": "Invoice validation failed with 2 errors",
    "details": {
      "validationResult": {
        "valid": false,
        "format": "cii",
        "schematronVersion": "1.3.16",
        "errors": [
          {
            "ruleId": "BR-DE-1",
            "severity": "error",
            "location": "/rsm:CrossIndustryInvoice/...",
            "message": "An XRechnung invoice must contain the buyer reference (BT-10)."
          }
        ],
        "warnings": []
      }
    }
  }
}

Full example

generate-full.sh
curl -X POST https://api.beliq.eu/v1/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "standard": "xrechnung",
    "profile": "en16931",
    "output": "xml",
    "invoice": {
      "number": "INV-2026-001",
      "issueDate": "2026-04-13",
      "dueDate": "2026-05-13",
      "currencyCode": "EUR",
      "buyerReference": "04011000-12345-03",
      "seller": {
        "name": "Acme GmbH",
        "vatId": "DE123456789",
        "email": "billing@acme.example",
        "address": {
          "street": "Musterstraße 1",
          "city": "Berlin",
          "postalCode": "10115",
          "countryCode": "DE"
        }
      },
      "buyer": {
        "name": "Bundesministerium für Beispiele",
        "vatId": "DE987654321",
        "email": "rechnung@beispiel.example",
        "address": {
          "street": "Beispielweg 42",
          "city": "Bonn",
          "postalCode": "53113",
          "countryCode": "DE"
        }
      },
      "lines": [
        {
          "description": "IT consulting — April 2026",
          "quantity": 20,
          "unitCode": "HUR",
          "unitPrice": 120.00,
          "lineTotal": 2400.00,
          "vatRate": 19,
          "vatCategoryCode": "S"
        }
      ],
      "paymentMeans": {
        "typeCode": "58",
        "iban": "DE89370400440532013000",
        "bic": "COBADEFFXXX"
      },
      "paymentTerms": "Net 30 days",
      "totalNetAmount": 2400.00,
      "totalTaxAmount": 456.00,
      "totalGrossAmount": 2856.00
    }
  }'

Italy FatturaPA ordinaria (FPR12) example

Beliq can emit FatturaPA ordinaria XML (standard: "fatturapa", default profile ordinaria). Compliance status for this profile is provisional: XSD-valid golden path, official positive samples in CI, plus a tier-honest T3 XSD structural negative (AGID FEL cross-validation) — an authority-published negative corpus URL is still absent. Beliq does not submit to Italy’s SDI interchange — you remain responsible for signing, transmission, and channel operation with your provider.

generate-fatturapa.sh
curl -X POST https://api.beliq.eu/v1/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "standard": "fatturapa",
    "profile": "ordinaria",
    "output": "xml",
    "invoice": {
      "number": "123",
      "issueDate": "2014-12-18",
      "dueDate": "2015-01-30",
      "currencyCode": "EUR",
      "italy": { "codiceDestinatario": "ABC1234", "regimeFiscale": "RF19" },
      "seller": {
        "name": "Alpha SRL",
        "vatId": "IT01234567890",
        "address": {
          "street": "Via Roma 1",
          "city": "Sassari",
          "postalCode": "07100",
          "countryCode": "IT",
          "region": "SS"
        }
      },
      "buyer": {
        "name": "Beta SpA",
        "taxId": "09876543210",
        "address": {
          "street": "Via Torino 2",
          "city": "Roma",
          "postalCode": "00145",
          "countryCode": "IT",
          "region": "RM"
        }
      },
      "lines": [
        {
          "description": "Supply",
          "quantity": 5,
          "unitCode": "C62",
          "unitPrice": 1,
          "lineTotal": 5,
          "vatRate": 22,
          "vatCategoryCode": "S"
        }
      ],
      "taxSummary": [
        {
          "vatCategoryCode": "S",
          "vatRate": 22,
          "taxableAmount": 5,
          "taxAmount": 1.1
        }
      ],
      "paymentMeans": { "typeCode": "58", "iban": "IT60X0542811101000000123456" },
      "totalNetAmount": 5,
      "totalTaxAmount": 1.1,
      "totalGrossAmount": 6.1
    }
  }'

Peppol BIS Billing 3.0 example

For cross-border EU invoicing over the Peppol Network, set standard: "peppol-bis". Both parties need a Peppol electronic-address (or a vatId + country Beliq can map to the standard EAS scheme), and the invoice must carry either a buyerReference or orderReference.

generate-peppol.sh
curl -X POST https://api.beliq.eu/v1/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "standard": "peppol-bis",
    "output": "xml",
    "invoice": {
      "number": "INV-2026-042",
      "issueDate": "2026-04-13",
      "currencyCode": "EUR",
      "buyerReference": "PO-2026-042",
      "seller": {
        "name": "Acme SARL",
        "vatId": "FR12345678901",
        "peppol": { "schemeId": "9957", "id": "FR12345678901" },
        "address": {
          "street": "12 Rue de Exemple",
          "city": "Paris",
          "postalCode": "75001",
          "countryCode": "FR"
        }
      },
      "buyer": {
        "name": "Voorbeeld B.V.",
        "vatId": "NL123456789B01",
        "peppol": { "schemeId": "9944", "id": "NL123456789B01" },
        "address": {
          "street": "Voorbeeldlaan 1",
          "city": "Amsterdam",
          "postalCode": "1011AB",
          "countryCode": "NL"
        }
      },
      "lines": [
        {
          "description": "Cloud subscription — April 2026",
          "quantity": 1,
          "unitCode": "MON",
          "unitPrice": 500.00,
          "lineTotal": 500.00,
          "vatRate": 21,
          "vatCategoryCode": "S"
        }
      ],
      "totalNetAmount": 500.00,
      "totalTaxAmount": 105.00,
      "totalGrossAmount": 605.00
    }
  }'

See the Peppol BIS Billing 3.0 reference for what fields Beliq emits and what the validator checks.