Skip to main content

Overview

The /api/validate/json endpoint is essential for development. It validates your invoice JSON and ensures it can be converted to valid UBL BIS Billing 3.0 format before you create any documents.
You cannot create documents with invalid JSON. The API will reject invoices that don’t meet UBL BIS Billing 3.0 standards. Always validate during development to catch errors early.

Why Validate?

  • No document creation: Validation doesn’t create any records - it’s risk-free testing
  • Fast feedback: Get instant validation results without creating documents
  • Detailed errors: Receive specific field-level error messages
  • UBL compliance: Ensures your JSON converts to valid UBL BIS Billing 3.0 XML
  • Save API calls: Fix errors before attempting to create documents

Basic Validation

Use POST /api/validate/json with your invoice data:
The example above will fail validation! This is intentional - it demonstrates why validation is critical. See below for the errors and how to fix them.

Response Types

Error Response (Real Example)

When validation fails, you’ll receive detailed UBL compliance errors. Here’s what the example above returns:
This is exactly why the validation endpoint exists! These UBL BIS Billing 3.0 compliance errors would prevent your invoice from being sent. Let’s fix them.

Fixed Example

Here’s a corrected version that passes validation:
What changed:
  1. Valid Belgian VAT numbers with correct mod97 checksums:
    • BE0897290877 (vendor) instead of BE0123456789
    • BE0817331995 (customer) instead of BE0987654321
  2. Added amount field to line items: "1000.00" (quantity × unit_price)

Success Response

When your JSON is valid, you’ll receive confirmation along with the generated UBL XML:
Response fields:
  • id: Validation session identifier
  • file_name: Generated XML filename
  • is_valid: true when validation passes
  • issues: Empty array when no errors
  • ubl_document: The generated UBL BIS Billing 3.0 XML (truncated above for readability)
Success means:
  • Your JSON is valid and UBL-compliant
  • You can see the exact UBL XML that will be generated
  • You’re ready to create the document using POST /api/documents/ with the same JSON payload
The ubl_document field shows you exactly what XML will be sent via Peppol. This is useful for debugging or understanding how your JSON maps to UBL BIS Billing 3.0.

Validating UBL XML

Use POST /api/validate/ubl to validate an existing UBL BIS Billing 3.0 XML file.
This endpoint expects multipart/form-data with a single file field — NOT a raw XML body. The most common integration mistake is sending the XML as the request body with Content-Type: application/xml, which returns a 422 with {"detail":[{"type":"missing","loc":["body","file"],"msg":"Field required"}]}. See common mistake below.

Request Contract

Copy-Paste Examples

Response

Success (valid UBL):
Validation errors:

Common mistake: raw XML body

If you set Content-Type: application/xml and send the XML as the raw request body (e.g. --data-binary @invoice.xml), you’ll get this 422 response:
The fix: switch to multipart/form-data with a file form field (as shown in the examples above).

When to Use UBL Validation

Use POST /api/validate/ubl when you:
  • Have existing UBL XML files to verify before sending (e.g. generated by your ERP)
  • Are migrating from another Peppol Access Point with pre-generated UBL documents
  • Need to validate UBL files from external sources before posting them to /api/documents/ubl
  • Want to double-check the XML produced by /api/validate/json (the ubl_document field in that response)
If you’re creating invoices from JSON, prefer /api/validate/json — it validates the same UBL rules and returns the generated UBL alongside, so you don’t need a separate UBL validation call.

Common Validation Errors

Invalid Peppol ID Format

Fix: Use the correct format scheme:identifier
  • Belgian companies: 0208:0123456789 (CBE number - VAT without ‘BE’ prefix)
  • See Peppol schemes

Invalid Tax Rate

Fix: Use string format for tax rates:
  • Standard rate: "21.00"
  • Reduced rate: "6.00"
  • Zero rated: "0.00"

Missing Required Fields

Fix: Ensure all required fields are present:
  • Vendor/customer name, tax ID, and address
  • Invoice ID, invoice date, currency
  • At least one item with description, quantity, unit price, and tax rate

Invalid Date Format

Fix: Use the format YYYY-MM-DD, e.g., 2024-10-24

Invalid Currency Code

Fix: Use supported ISO 4217 codes: EUR, USD, GBP, JPY, CHF, CAD, AUD, NZD, CNY, INR, SEK, NOK, DKK, SGD, HKD

Development Workflow

1. Build Your Invoice JSON

Start with a template or build your invoice object:

2. Validate First

Always validate before attempting to create:

3. Create Document

Only after validation passes, create the document:

Complete Development Example

Testing Strategy

During Development

Use /api/validate/json liberally:
  1. Test edge cases: Validate unusual scenarios (zero amounts, multiple currencies, etc.)
  2. Test all document types: Validate invoices, credit notes, and debit notes
  3. Iterate quickly: Fix errors and re-validate without creating documents
  4. Build test suites: Create automated validation tests

Before Production

  1. Validate representative samples of all invoice types
  2. Test with real customer Peppol IDs
  3. Verify all tax categories and currency codes you’ll use
  4. Test complex scenarios (allowances, charges, multiple line items)

Best Practices

Don’t wait until production. Validate during development to catch issues early:
  • Test each new invoice template
  • Validate after schema changes
  • Include validation in CI/CD pipelines
If you’re generating invoices from templates, validate the template once and cache the result:
Test validation extensively with a sandbox company before going live:
  • A sandbox company sends via email instead of Peppol, so testing is safe
  • Use the production API: https://api.e-invoice.be
  • Create a sandbox company from app.e-invoice.be

Next Steps

Create Invoices

Create and send validated invoices

Lookup Participants

Find valid Peppol IDs

Set Up Webhooks

Get notified about events

API Reference

Explore all endpoints