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.
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
UsePOST /api/validate/json with your invoice data:
Response Types
Error Response (Real Example)
When validation fails, you’ll receive detailed UBL compliance errors. Here’s what the example above returns:Fixed Example
Here’s a corrected version that passes validation:- Valid Belgian VAT numbers with correct mod97 checksums:
BE0897290877(vendor) instead ofBE0123456789BE0817331995(customer) instead ofBE0987654321
- Added
amountfield 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:id: Validation session identifierfile_name: Generated XML filenameis_valid:truewhen validation passesissues: Empty array when no errorsubl_document: The generated UBL BIS Billing 3.0 XML (truncated above for readability)
- 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
Validating UBL XML
UsePOST /api/validate/ubl to validate an existing UBL BIS Billing 3.0 XML file.
Request Contract
Copy-Paste Examples
Response
Success (valid UBL):Common mistake: raw XML body
If you setContent-Type: application/xml and send the XML as the raw request body (e.g. --data-binary @invoice.xml), you’ll get this 422 response:
multipart/form-data with a file form field (as shown in the examples above).
When to Use UBL Validation
UsePOST /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(theubl_documentfield in that response)
Common Validation Errors
Invalid Peppol ID Format
scheme:identifier
- Belgian companies:
0208:0123456789(CBE number - VAT without ‘BE’ prefix) - See Peppol schemes
Invalid Tax Rate
- Standard rate:
"21.00" - Reduced rate:
"6.00" - Zero rated:
"0.00"
Missing Required Fields
- 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
YYYY-MM-DD, e.g., 2024-10-24
Invalid Currency Code
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:
- Test edge cases: Validate unusual scenarios (zero amounts, multiple currencies, etc.)
- Test all document types: Validate invoices, credit notes, and debit notes
- Iterate quickly: Fix errors and re-validate without creating documents
- Build test suites: Create automated validation tests
Before Production
- Validate representative samples of all invoice types
- Test with real customer Peppol IDs
- Verify all tax categories and currency codes you’ll use
- Test complex scenarios (allowances, charges, multiple line items)
Best Practices
Validate Early and Often
Validate Early and Often
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
Handle Validation Errors Gracefully
Handle Validation Errors Gracefully
Cache Validation Results
Cache Validation Results
If you’re generating invoices from templates, validate the template once and cache the result:
Use a Sandbox Company
Use a Sandbox Company
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