POST /validate/mustang – Validate with Mustang

REST-API · POST /validate/mustang · paid route

Validate with Mustang: the second opinion on ZUGFeRD and Factur-X.

This route validates an e-invoice with Mustang, the open-source validation program from the ZUGFeRD and Factur-X community. You get its report back unchanged, as XML or as a summary in JSON.

For a PDF, Mustang also checks the PDF itself against PDF/A-3. That makes the route useful when you want to check ZUGFeRD and Factur-X invoices completely.


Request

How to call the route

Address: POST https://invoicepress.de/wp-json/einvoice-api/v1/validate/mustang

Key: Send your API key in the header Authorization: Bearer <key> or in X-Api-Key. Both work the same way. Without a key, the free quota of two calls per route and day applies; a key that is sent but not valid gets status 401.

Body: The body of the request is the invoice itself: as XML (XRechnung, Peppol BIS, CII or UBL) with Content-Type: application/xml, or as a ZUGFeRD or Factur-X PDF with Content-Type: application/pdf. From a PDF the service first takes the embedded invoice.

Parameters

format (optional) – json for the summary, xml for the unchanged report.

X-Filename (header, optional) – The file name, URL-encoded. It appears in the report.

This route passes the invoice on to the Validator Bridge on our server. The bridge is a small program that runs the validator there. The invoice goes to this bridge and to no other service.

The invoice is processed in memory only and is not stored. The usage log keeps a fingerprint of the request, never its content.


Answer

What comes back

Status 200 – also for an invalid invoice. The result stands in the header X-Validation-Result with valid or invalid and in the report.

Without a parameter or with ?format=json – you get a summary as JSON.

With ?format=xml – you get the unchanged validation report of the validator.

Errors – come as JSON with the fields error (a short code) and message.

When something goes wrong

Status 401 – A key was sent, but it is not valid.

Status 403 – The route is switched off on this service.

Status 429 – The quota is used up. The header Retry-After tells you when it works again.

Status 502 – The Validator Bridge behind the service does not answer.

Status 503 – This validator is not available on this service.


Example

A call with curl

curl -X POST "https://invoicepress.de/wp-json/einvoice-api/v1/validate/mustang?format=xml" \
     -H "X-Api-Key: <key>" \
     -H "Content-Type: application/xml" \
     --data-binary @invoice.xml -o report.xml

Cost

Quota and plan

This route is a paid route. With a key, every successful call counts as one validation against the monthly quota of your plan; answers with an error status are not counted. To try it, you can call the route twice a day without a key. This limit applies per network address and per route: two calls to this route leave the other routes untouched. Every answer without a key tells you in the headers X-RateLimit-Remaining and X-RateLimit-Reset how many calls are left today and when the counter resets.