Skip to content

Delivery routing

Send every invoice to one endpoint and let the service do the rest: validate it, pick the right destination, convert it if that destination needs another format, deliver it signed, retry when the destination is down, and record each step.

Routing delivers to your own systems — an ERP import, an archive, an accounting inbox — over https. It is not a Peppol access point and does not submit to tax platforms; documents never go to third parties.

Routes

curl -X POST https://einvoiceengine.com/v1/routes -H "Authorization: Bearer $EINV_KEY" -H "Content-Type: application/json" \
  -d '{ "name": "ERP inbox", "url": "https://erp.example.com/einvoices", "formats": ["xrechnung-ubl", "zugferd-facturx"], "convertTo": "cii", "requireValid": true, "priority": 10 }'

A route has a url (https, public address), optional formats (empty: any), requireValid (default true: invalid invoices are not delivered), an optional convertTo (cii, ubl, xrechnung-ubl, peppol-bis-billing, zugferd-facturx, …) and a priority (lower first). The response contains the signing secret once. Routes belong to the mode of the key (test or live). GET /v1/routes, PATCH /v1/routes/{id} (enabled, priority, name), DELETE /v1/routes/{id}; creating and changing routes needs the keys:write scope.

Routing an invoice

POST /v1/invoices/route with the document (raw body or JSON, like validate) returns 202 and { id, status: "queued", route, validation }, or 200 with status: "rejected" and reason invalid, no_route or conversion_failed. Each routed document counts as one document: the validation is billed, the conversion for the route is included (see usage and billing). Send an Idempotency-Key so a retried request is neither routed nor billed twice.

The delivery is a POST of the document (Content-Type as delivered) with the headers webhook-id, webhook-timestamp, webhook-signature (v1, + base64 HMAC-SHA256 of id.timestamp. followed by the body bytes, with your route secret), x-einv-format, x-einv-validation-status and x-einv-sha256. Answer 2xx to confirm; a X-Receipt-Id response header is stored as the receipt. A tested receiver that verifies the signature over the raw bytes is in docs/examples/einv-receiver.mjs. Deleting a route fails the documents still queued for it and deletes their copies.

Status, retries, dead letters

GET /v1/routed/{id} shows the status (queued, delivered, failed, rejected), the attempts, the last answer, the receipt and the history of every step (validated, matched, converted, queued, attempt_failed, delivered, failed, retried). Failed attempts are retried over about 1.5 days; then the delivery is failed and the document is kept as a dead letter for 7 days — POST /v1/routed/{id}/retry sends it again. Delivered documents are deleted from the queue at once. Events delivery.succeeded and delivery.failed go to your webhooks. The same is in Dashboard → Delivery routes.

Checking incoming invoices first

Routing delivers what passed the official rules (requireValid). To also catch duplicates and invoices that do not match a purchase order before they reach your ERP, check them with POST /v1/invoices/inbound first.