Overview
The e-invoice.be API allows you to create documents directly from PDF files using AI-powered data extraction. This is useful when:- You have existing PDF invoices you want to send via Peppol
- Your system generates PDF invoices but not structured data
- You want to digitize paper invoices
- You’re migrating from traditional PDF invoicing to e-invoicing
How It Works
Upload a PDF invoice and the API automatically extracts invoice data and attempts to generate a valid UBL document. If theubl_document field is present in the response, sufficient details were extracted to create a Peppol-compliant document ready for sending.
The API provides two processing modes:
- Synchronous - Immediate processing with instant results (recommended for most cases)
- Asynchronous - Long-running conversions with task polling (for complex PDFs)
Method 1: Synchronous PDF Upload
Upload a PDF file and receive immediate extraction results.Basic Upload
Upload with Tax IDs (Recommended)
Providing tax IDs improves extraction accuracy:Response
The response contains extracted invoice data and, if successful, a UBL document ready for sending:If the
ubl_document field is present in the response, the PDF contained sufficient information to generate a valid UBL document. You can then create a document from this UBL and send it via Peppol.Creating a Document from Extracted UBL
If the response contains aubl_document, create and send it:
Method 2: Asynchronous PDF Upload
For complex PDFs or when immediate processing isn’t required, use the asynchronous endpoint.Step 1: Initiate Conversion
Step 2: Check Status
pending, completed, failed
Step 3: Retrieve Result
Code Examples
Node.js - Synchronous Upload
Python - Synchronous Upload
Node.js - Asynchronous Upload with Polling
Complete Workflow Example
Here’s a complete example that extracts data from a PDF and sends it via Peppol:PDF Requirements
File Format
- Format: PDF (Portable Document Format)
- Content: Must be valid and non-empty
- Text extraction: PDFs with readable text produce better results
Text-based PDFs generated from software (not scanned documents) produce the most accurate extraction results. Providing vendor and customer tax IDs as query parameters significantly improves extraction accuracy.
Best Practices for PDFs
- Use text-based PDFs: Generated from software rather than scanned images
- Clear layout: Structured format with clear sections for vendor, customer, line items
- Readable fonts: Standard fonts with good contrast
- Complete information: All required invoice fields clearly visible
- Single invoice per PDF: Don’t combine multiple invoices in one file
- Provide tax IDs: Include
vendor_tax_idandcustomer_tax_idquery parameters
Common Issues
Invalid or Empty PDF
Status Code:415 Unsupported Media Type
Solution:
- Ensure the file is a valid PDF document
- Check the file is not corrupted
- Verify the file is not empty
No UBL Document Generated
Issue: Response contains extracted data but noubl_document field
Cause: The PDF didn’t contain sufficient information to generate a complete UBL document
Solution:
- Review the extracted data in the response
- Provide
vendor_tax_idandcustomer_tax_idquery parameters - Use a more detailed PDF with complete invoice information
- Manually create the document using the JSON API with the extracted data as a starting point
Extraction Inaccuracies
Issue: Extracted amounts, dates, or tax IDs are incorrect Solution:- Always provide
vendor_tax_idandcustomer_tax_idas query parameters - Use text-based PDFs rather than scanned images
- Ensure the PDF has a clear, structured layout
- Review extracted data before creating documents
Authentication Errors
Status Code:401 Unauthorized
Solution:
- Verify your API key is correct
- Ensure the
Authorizationheader is properly formatted:Bearer YOUR_API_KEY - Check your API key has not expired
Best Practices
Always Provide Tax IDs
Always Provide Tax IDs
Include vendor and customer tax IDs as query parameters for better extraction:
Verify UBL Generation
Verify UBL Generation
Always check if a UBL document was generated before proceeding:
Use Asynchronous Processing for Large Batches
Use Asynchronous Processing for Large Batches
For processing multiple PDFs, use the async endpoint to avoid timeouts:
Keep Original PDFs
Keep Original PDFs
Store original PDFs for audit and compliance purposes:
Validate Extracted Data
Validate Extracted Data
Review extracted data before sending, especially for critical fields:
Next Steps
Creating Invoices
Learn standard JSON invoice creation
UBL Documents
Create from UBL XML files
Validation Guide
Test invoice data
API Reference
Explore all endpoints