E-Invoice Detection API
Upload any email attachment and find out whether it is an e-invoice, which format and profile it uses, and where to validate it.
https://api.invoicexml.com/v1/extract/meta
- ZUGFeRD and Factur-X PDFs told apart from plain PDFs
- CII, UBL and XRechnung invoices supported in either syntax
- Declared profile and validation endpoint to call
- Tells you if the invoice contains attachments
Technical reference
Sort incoming documents before you process them. Upload one file, typically an attachment from an inbound invoice mailbox, and the endpoint tells you what it is: a hybrid ZUGFeRD or Factur-X PDF, an XML e-invoice in CII or UBL syntax (XRechnung in either syntax included), or a regular PDF or other file that carries no e-invoice. For an e-invoice it reports the syntax, the profile declared in the specification identifier (BT-24), the validation endpoint to call next, and whether the invoice XML embeds supporting documents (BG-24). The file type is read from the content, so the filename and media type of the attachment do not matter.
Code Example
curl -X POST https://api.invoicexml.com/v1/extract/meta \ -H "Authorization: Bearer YOUR_API_KEY" \ -F "[email protected]"
Send each attachment on its own. Branch on isEInvoice, then send the same file to the endpoint in
validateWith.
Request
| Parameter | Type | Description |
|---|---|---|
| file * | binary | The file to detect, of any type. Its name and media type are not used. |
Headers
| Header | Value |
|---|---|
| Authorization * | Bearer YOUR_API_KEY |
| Content-Type | multipart/form-data |
Response
200 Detection result
Returns a JSON object describing the uploaded file. Every file that could be read is answered with 200, e-invoice or not.
A ZUGFeRD PDF with an embedded timesheet:
{
"type": "hybrid-pdf",
"isEInvoice": true,
"syntax": "cii",
"profile": "en16931",
"customizationId": "urn:cen.eu:en16931:2017",
"validateWith": "/v1/validate/zugferd",
"hasAttachments": true
}
A regular PDF:
{
"type": "pdf",
"isEInvoice": false,
"syntax": null,
"profile": null,
"customizationId": null,
"validateWith": null,
"hasAttachments": false
}
| Field | Description |
|---|---|
| type | hybrid-pdf for a PDF carrying a ZUGFeRD, Factur-X or XRechnung invoice XML, xml for a CII or UBL e-invoice, pdf for a PDF without an invoice XML, other for any other file, including XML that is no invoice. |
| isEInvoice | true for hybrid-pdf and xml. |
| syntax | cii or ubl. |
| profile | The profile the document declares, with the same values as data.profile in the validation responses: minimum, basic-wl, basic, en16931, extended, extended-ctc-fr or xrechnung for CII, and en16931, peppol-bis-3, xrechnung, nlcius or pint for UBL. null when the identifier is missing or not a known profile. |
| customizationId | The specification identifier (BT-24) exactly as the document declares it. |
| validateWith | The validation endpoint for this file: /v1/validate/zugferd for a hybrid PDF, /v1/validate/xrechnung for XRechnung XML in either syntax, otherwise /v1/validate/cii or /v1/validate/ubl. |
| hasAttachments | true when the invoice XML embeds supporting documents (BG-24 with a BT-125 file). Download them with POST /v1/extract/attachments. |
Fields without a value are null, so every response has the same shape.
Error Reference
Errors are returned as RFC 7807 ProblemDetails, using the same envelope as every other endpoint; see Error handling for the full list. The codes specific to this endpoint:
| errorCode | HTTP status | Meaning |
|---|---|---|
| 4003 | 400 | No file. The request carries no file part, or the file is empty. |
| 4007 | 400 | The file is a PDF that could not be opened, for example because it is damaged or encrypted. |
Useful resources
Companion material for integrating against the API.
Runnable samples in C#, Java, PHP, Python, Node.js, and browser JavaScript, one repository per format.
github.com/InvoiceXML
Typed clients for C#, Java, PHP, Node.js and Python, installed from the registry you already use.
www.invoicexml.com/docs/sdk
The full OpenAPI 3.1 document. Drop it into Postman, Insomnia, or any code generator to scaffold a client.
api.invoicexml.com/v1/openapi
Browse and call every endpoint directly from the browser, powered by Scalar.
api.invoicexml.com/v1/scalar
Frequently Asked Questions
Ready to automate your invoices?
Validate, convert and embed compliant e-invoices through one API. Start your 30-day free trial. No credit card required.