Skip to content

Validation

Every generated invoice is automatically validated against ZUGFeRD 2.3 / Factur-X 1.0 standards.

Automatic Validation

When you generate an invoice, the response includes validation information:

json
{
  "pdf_base64": "...",
  "validation": {
    "status": "valid",
    "profile": "EN16931",
    "version": "2.3.2"
  }
}

Validation Status

StatusDescription
validInvoice meets all ZUGFeRD/Factur-X requirements
invalidInvoice has validation errors

Profiles

ZUGFeRD 2.3 supports multiple conformance profiles:

ProfileDescriptionUse Case
MINIMUMBasic information onlySimple invoices
BASICBasic invoice dataSmall businesses
EN16931Full EU standardB2G invoices (required)
EXTENDEDAdditional fieldsComplex requirements

thelawin.dev always generates EN16931 profile invoices to ensure maximum compatibility.

Validating Existing PDFs

You can also validate existing PDF files using the /v1/validate endpoint:

bash
curl -X POST https://api.thelawin.dev/v1/validate \
  -H "X-API-Key: env_sandbox_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "pdf_base64": "JVBERi0xLjcK..."
  }'

Response

json
{
  "valid": true,
  "profile": "EN16931",
  "version": "2.3.2",
  "errors": [],
  "warnings": [
    {
      "code": "BR-CL-10",
      "message": "Currency code should be from ISO 4217"
    }
  ]
}

Common Validation Errors

Missing Required Fields

json
{
  "valid": false,
  "errors": [
    {
      "code": "BR-02",
      "path": "$.invoice.seller.vatId",
      "message": "Seller VAT identifier is required"
    }
  ]
}

Invalid VAT ID Format

json
{
  "valid": false,
  "errors": [
    {
      "code": "BR-CO-09",
      "path": "$.invoice.seller.vatId",
      "message": "VAT identifier must match country format"
    }
  ]
}

Invalid Unit Code

json
{
  "valid": false,
  "errors": [
    {
      "code": "BR-CL-23",
      "path": "$.invoice.items[0].unit",
      "message": "Unit code must be from UN/ECE Recommendation 20"
    }
  ]
}

See Unit Codes for valid unit codes.

Best Practices

  1. Always check validation status - Even in sandbox mode, ensure your invoices are valid
  2. Use correct VAT formats - Match the VAT ID format to the country (e.g., DE123456789 for Germany)
  3. Include required fields - Seller name, address, and VAT ID are always required
  4. Use standard unit codes - See Unit Codes for the complete list

ZUGFeRD 2.3 & Factur-X 1.0 compliant