Automation MCP Server Blog Pricing

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.

POST 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.

Content-Type: application/json

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.

Frequently Asked Questions

How do I tell a ZUGFeRD PDF from a regular PDF?

Send the PDF to POST /v1/extract/meta. A ZUGFeRD or Factur-X PDF answers with type hybrid-pdf and isEInvoice true; a PDF without an embedded invoice XML answers with type pdf and isEInvoice false. Both are HTTP 200, so an automated flow can branch on isEInvoice alone.

Which file types can I send?

Any file an email can carry: PDFs, XML files, images, Office documents and more. The type is read from the file content, not from its name or media type, and every readable file that is no e-invoice is answered with type pdf or other instead of an error.

Which profiles are detected?

The profile declared in the specification identifier (BT-24): MINIMUM, BASIC WL, BASIC, EN 16931, EXTENDED, EXTENDED-CTC-FR and XRechnung for CII and hybrid PDFs, and EN 16931, Peppol BIS Billing 3.0, XRechnung, NLCIUS and PINT for UBL. The values match data.profile in the validation responses, and the identifier itself is returned in customizationId.

Which validation endpoint does validateWith name?

POST /v1/validate/zugferd for hybrid PDFs (the Factur-X route runs the same checks), POST /v1/validate/xrechnung for XRechnung XML in either syntax, POST /v1/validate/cii for other CII XML and POST /v1/validate/ubl for other UBL XML. Send the same file to that endpoint.

Does detection validate the invoice?

Detection reads what the document declares about itself and answers fast. Whether the invoice is compliant is the job of the validation endpoint named in validateWith.

How do I get the embedded attachments themselves?

When hasAttachments is true, the invoice XML embeds supporting documents (BG-24), such as a timesheet or a delivery note. To download them, send the same file to POST /v1/extract/attachments, which returns them as one ZIP.

Start free today

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.

GDPR Compliant No credit card required Setup in minutes
Peppol UBL
Factur-X
EN 16931
142 / 142 passed
Compliant
PDF/A-3 embedded