Skip to content

Generate Invoice

Generate a ZUGFeRD/Factur-X compliant PDF invoice conforming to EN 16931.

Endpoint

POST https://api.envoice.dev/v1/generate

Headers

HeaderRequiredDescription
X-API-KeyYesYour API key
Content-TypeYesapplication/json

Request Body

json
{
  "template": "minimal",
  "locale": "en",
  "accentColor": "#8b5cf6",
  "footerText": "Thank you for your business!",
  "logo": {
    "base64": "data:image/png;base64,...",
    "widthMm": 30
  },
  "invoice": {
    "number": "2026-001",
    "date": "2026-01-15",
    "dueDate": "2026-02-15",
    "currency": "EUR",
    "typeCode": "380",
    "buyerReference": "PO-12345",
    "note": "Project Alpha Q1",
    "seller": {
      "name": "Acme GmbH",
      "tradingName": "Acme Solutions",
      "vatId": "DE123456789",
      "street": "Hauptstraße 1",
      "city": "Berlin",
      "postalCode": "10115",
      "country": "DE",
      "email": "billing@acme.de",
      "phone": "+49 30 12345678"
    },
    "buyer": {
      "name": "Customer AG",
      "vatId": "DE987654321",
      "street": "Kundenweg 42",
      "city": "München",
      "postalCode": "80331",
      "country": "DE"
    },
    "items": [
      {
        "description": "Consulting Services",
        "quantity": 8,
        "unit": "HUR",
        "unitPrice": 150.00,
        "vatRate": 19.0,
        "vatCategory": "S"
      }
    ],
    "payment": {
      "meansCode": "58",
      "iban": "DE89 3704 0044 0532 0130 00",
      "bic": "COBADEFFXXX",
      "accountName": "Acme GmbH",
      "reference": "INV-2026-001",
      "terms": "Net 30 days"
    }
  }
}

Parameters

Root Level

FieldTypeRequiredDescription
templatestringNominimal, classic, or compact. Default: minimal
localestringNoen, de, fr, es, it. Default: en
accentColorstringNoHex color code. Default: #8b5cf6
footerTextstringNoCustom footer text
logoobjectNoLogo configuration
invoiceobjectYesInvoice data
FieldTypeRequiredDescription
base64stringYesBase64-encoded image (PNG, JPEG, SVG)
widthMmnumberNoLogo width in mm. Default: 30

Invoice Object

FieldTypeRequiredEN 16931Description
numberstringYesBT-1Invoice number
datestringYesBT-2Invoice date (YYYY-MM-DD)
dueDatestringNoBT-9Due date (YYYY-MM-DD)
currencystringNoBT-5ISO 4217 code. Default: EUR
typeCodestringNoBT-3Document type code (380=Invoice, 381=Credit Note). Default: 380
buyerReferencestringNoBT-10Buyer's reference (e.g. PO number)
notestringNoBT-22Invoice note / project reference
sellerobjectYesBG-4Seller information
buyerobjectYesBG-7Buyer information
itemsarrayYesBG-25Line items (min 1)
paymentobjectNoBG-16Payment information

Invoice Number

The invoice number (BT-1) must be unique and is used as the primary identifier.

Invoice Date

The invoice date (BT-2) in ISO 8601 format: YYYY-MM-DD

Due Date

The payment due date (BT-9) in ISO 8601 format: YYYY-MM-DD

Currency

ISO 4217 currency code (BT-5). Supported: EUR, USD, GBP, CHF, etc.

Address Object (Seller/Buyer)

FieldTypeRequiredEN 16931Description
namestringYesBT-27/BT-44Legal name
tradingNamestringNoBT-28/BT-45Trading name (if different)
vatIdstringSeller: YesBT-31/BT-48VAT identification number
streetstringNoBT-35/BT-50Street address
citystringYesBT-37/BT-52City
postalCodestringNoBT-38/BT-53Postal code
countrystringYesBT-40/BT-55ISO 3166-1 alpha-2 code
emailstringNoBT-43/BT-58Email address
phonestringNoBT-42/BT-57Phone number

Line Item Object

FieldTypeRequiredEN 16931Description
descriptionstringYesBT-153Item description
quantitynumberYesBT-129Quantity
unitstringYesBT-130Unit code (UN/ECE Rec 20)
unitPricenumberYesBT-146Net price per unit
vatRatenumberYesBT-152VAT rate (e.g., 19.0 for 19%)
vatCategorystringNoBT-151VAT category code (S, Z, E, AE, K, G, O, L, M). Default: S

VAT Category Codes

CodeDescription
SStandard rate
ZZero rated
EExempt
AEReverse charge
KIntra-community supply
GExport outside EU
OOutside scope of VAT
LCanary Islands
MCeuta and Melilla

Payment Object

FieldTypeRequiredEN 16931Description
meansCodestringNoBT-81Payment means code (30=Bank transfer, 58=SEPA). Default: 58
ibanstringNoBT-84IBAN
bicstringNoBT-86BIC/SWIFT code
accountNamestringNoBT-85Account holder name
referencestringNoBT-83Payment reference
termsstringNoBT-20Payment terms description

Payment Means Codes

CodeDescription
30Credit transfer
58SEPA credit transfer
59SEPA direct debit

Response

Success (200)

json
{
  "pdf_base64": "JVBERi0xLjcK...",
  "filename": "invoice-2026-001.pdf",
  "validation": {
    "status": "valid",
    "profile": "EN16931",
    "version": "2.3.2"
  },
  "account": {
    "remaining": 499,
    "plan": "starter"
  }
}

Error (400/422)

json
{
  "error": "validation_failed",
  "message": "Invoice validation failed",
  "details": [
    {
      "path": "$.invoice.seller.vatId",
      "code": "REQUIRED",
      "message": "Seller VAT ID is required",
      "expected": "string (e.g. DE123456789)"
    }
  ],
  "docs": "https://docs.envoice.dev/api/generate#address-object"
}

Example

bash
curl -X POST https://api.envoice.dev/v1/generate \
  -H "X-API-Key: env_sandbox_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "template": "minimal",
    "invoice": {
      "number": "2026-001",
      "date": "2026-01-15",
      "seller": {
        "name": "Acme GmbH",
        "vatId": "DE123456789",
        "city": "Berlin",
        "country": "DE"
      },
      "buyer": {
        "name": "Customer AG",
        "city": "München",
        "country": "DE"
      },
      "items": [{
        "description": "Consulting",
        "quantity": 8,
        "unit": "HUR",
        "unitPrice": 150,
        "vatRate": 19
      }]
    }
  }'

EN 16931 Compliance

This API generates invoices compliant with:

  • EN 16931 - European standard for electronic invoicing
  • ZUGFeRD 2.3 - German e-invoice standard (PDF/A-3 with embedded XML)
  • Factur-X 1.0 - French equivalent of ZUGFeRD

All generated PDFs include embedded XML metadata that can be extracted and processed automatically by accounting software.

ZUGFeRD 2.3 & Factur-X 1.0 compliant