Error handling
Every error has the same shape:
{
"error": {
"code": "semantic_loss",
"message": "2 source element(s) have no equivalent in the canonical model and would be lost.",
"status": 422,
"details": { "unsupportedFields": [ … ] },
"requestId": "req_7b1e…",
"docs": "https://einvoiceengine.com/docs/errors#semantic_loss"
}
}
Quote requestId (also in the X-Request-Id response header) when contacting support. You can send your own X-Request-Id (8–64 characters) to correlate logs.
An invalid invoice is not an error: validation returns 200 with status: "invalid". Problems with the file itself (malformed XML, DTDs, wrong encoding, an unknown format, a PDF without an embedded invoice, an empty document) are also reported by validate as findings in a 200 response. parse, convert and fix return them as the errors below.
Codes
| HTTP | Code | What to do |
|---|---|---|
| 400 | invalid_request, invalid_json, document_empty |
Fix the request |
| 400 | invalid_idempotency_key |
Use 1–255 printable ASCII characters |
| 400 | invalid_target, invalid_mapping, too_many_invoices, invalid_cursor, invalid_scope, invalid_url, limit_reached, unknown_test_case |
Fix the named field; see below |
| 401 | missing_api_key, invalid_api_key |
Send a valid key |
| 401 | widget_session_expired |
Create a new widget session |
| 402 | quota_exceeded |
Monthly quota used up; upgrade or wait for details.resetsAt |
| 402 | customer_limit_reached |
The partner's monthly limit for this customer is reached |
| 402 | plan_required |
Feature needs a paid plan |
| 402 | licence_expired, licence_invalid, licence_limit_reached, licence_feature_missing |
Self-hosted only: renew or replace the licence; see below |
| 403 | insufficient_scope, mcp_not_allowed, not_a_partner |
Use a key with the scope, plan or partner access |
| 404 | not_found, unknown_rule |
Unknown id, or it belongs to another organization or mode |
| 405 | method_not_allowed |
Use POST for MCP |
| 409 | idempotency_key_reused |
Same key sent with a different request |
| 409 | idempotency_in_progress |
The first request with this key is still running; retry shortly |
| 409 | not_retryable, too_many_keys, customer_exists |
See below |
| 413 | document_too_large |
Max 10 MB per document (2 MB for the free validator, the widget and MCP) |
| 415 | unsupported_media_type, unsupported_encoding |
Send UTF-8 XML or PDF |
| 422 | unsupported_format |
Not a supported e-invoice syntax |
| 422 | malformed_xml, forbidden_xml_construct, xml_too_deep, xml_too_many_nodes |
Fix the XML |
| 422 | semantic_loss, target_data_required, source_invalid, conversion_output_invalid, unsupported_conversion |
See Conversion |
| 422 | invalid_invoice_data, generated_document_invalid |
See Creating invoices |
| 422 | fix_not_allowed |
See Fixing |
| 422 | unsupported_rules_version |
Use a listed rule-set version or latest |
| 422 | pdf_no_embedded_invoice, invalid_pdf |
Upload the XML or a ZUGFeRD / Factur-X PDF |
| 422 | invalid_spreadsheet |
Save the file as an Excel workbook (.xlsx) |
| 429 | rate_limited, daily_limit_reached, widget_session_used_up |
Back off; see Retry-After |
| 502 | connector_failed |
The connected accounting system returned an error |
| 503 | validator_unavailable |
Temporary; retry with backoff |
| 500 | internal_error |
Retry; contact support with the request id if it persists |
Codes only the dashboard, sign-in and billing pages return are listed at the end.
Code reference
invalid_request
HTTP 400. A required field is missing or has the wrong type or range, for example target on convert, origin on a widget session, or a bad period on partner usage. The message names the field. Fix the request; do not retry it unchanged.
invalid_json
HTTP 400. The body was sent as application/json but is not valid JSON. Fix the body.
document_empty
HTTP 400. The document or request body is empty. Send the invoice file.
invalid_idempotency_key
HTTP 400. The Idempotency-Key header is not 1–255 printable ASCII characters.
invalid_target
HTTP 400. target on POST /v1/invoices/convert is not one of ubl, cii, xrechnung-ubl, xrechnung-cii, en16931-ubl, en16931-cii, peppol-bis-billing, zugferd-facturx.
invalid_mapping
HTTP 400. The mapping of POST /v1/invoices/generate/csv or POST /v1/invoices/generate/xml does not fit the file: a column or sheet that does not exist, a path that is not supported or matches nothing, more than 5,000 rows. The message says what is wrong. See Invoices from CSV, Excel and XML exports.
too_many_invoices
HTTP 400. The export file holds more than 100 invoices (200 in the dashboard). Split the file.
invalid_cursor
HTTP 400. The cursor of GET /v1/invoices was not returned by a previous page. Start again without a cursor.
invalid_scope
HTTP 400. Creating a key with an unknown scope, or a CI key (scope ci) with a scope other than validate. details.allowed lists the valid scopes. See Authentication.
invalid_url
HTTP 400. A webhook or route URL is not a valid URL, is longer than 2,000 characters, contains a user name or password, does not use https, or does not point to a public address.
limit_reached
HTTP 400. An organization limit is reached: 10 webhook endpoints, 20 delivery routes, 50 connectors or 1,000 active bureau clients. Delete unused ones first.
unknown_test_case
HTTP 400. POST /v1/testdata was asked for a case that does not exist. details.available lists the cases; GET /v1/testdata/cases too.
missing_api_key
HTTP 401. No Authorization: Bearer or X-API-Key header. Send a key.
invalid_api_key
HTTP 401. The key is unknown, revoked or expired. Create a new key in the dashboard.
widget_session_expired
HTTP 401. The widget session does not exist or its lifetime is over. Your server creates a new session with POST /v1/widget/sessions. See the widget.
quota_exceeded
HTTP 402. The monthly quota of the plan or contract is used up and there is no overage billing. details has used, limit, plan and resetsAt. Upgrade, or wait for the next month. See Usage and billing.
customer_limit_reached
HTTP 402. The account belongs to a partner, and the partner's monthly limit of live documents for this customer is reached. details has used and limit. The partner can raise or remove the limit. See partners.
plan_required
HTTP 402. The feature needs a paid plan: live keys need Developer, Growth or a contract; POST /v1/batches needs Growth.
licence_expired
HTTP 402, self-hosted installations only. The installation's licence expired more than 14 days ago (after the expiry date everything keeps working for a 14-day grace period). Requests with live keys are refused; test keys, the dashboard and reading or exporting stored data keep working. details has expires and graceEndsOn. Replace the file at LICENCE_FILE with a renewed licence; no restart is needed. See self-hosting.
licence_invalid
HTTP 402, self-hosted installations only. There is no valid licence: LICENCE_FILE is not set, cannot be read, or its signature does not match. details.reason says which. Live keys are refused; test keys keep working. See self-hosting.
licence_limit_reached
HTTP 402, self-hosted installations only. The licence caps live documents per calendar month for the whole installation, and the cap is reached. details has used and limit. Live requests work again next month or with a licence with a higher cap.
licence_feature_missing
HTTP 402, self-hosted installations only. The licence does not include the feature (details.feature: mcp for the MCP endpoint, partner for the partner API and partner dashboard).
insufficient_scope
HTTP 403. The key lacks the scope this endpoint needs. The message names the scope. Use or create a key with it.
mcp_not_allowed
HTTP 403. The key has no mcp scope, or it is a live key on the Free plan. Test keys can use MCP on every plan.
not_a_partner
HTTP 403. A partner call from an organization that is not enabled as a partner. Ask support.
not_found
HTTP 404. The id does not exist, or it belongs to another organization or to the other mode (test or live). Also returned for invoices whose retention period is over.
unknown_rule
HTTP 404 (MCP only). explain_validation_error was asked for a rule that is not in the current rule set. GET /v1/rules lists the rules.
method_not_allowed
HTTP 405. The MCP endpoint takes only POST (stateless Streamable HTTP).
idempotency_key_reused
HTTP 409. The same Idempotency-Key was sent with a different request. Use a new key for a new request.
idempotency_in_progress
HTTP 409. The first request with this key is still running. Retry shortly.
not_retryable
HTTP 409. Only failed jobs and failed routed documents can be retried, and only within 7 days of failing. After that their input is deleted. Send the document again.
too_many_keys
HTTP 409. The organization already has 25 active keys. Revoke unused keys first.
customer_exists
HTTP 409. A partner customer with this externalRef exists already. Use another reference, or work with the existing customer.
document_too_large
HTTP 413. The document is larger than 10 MB, or larger than 2 MB for the free validator, the widget and MCP. Documents above 2 MB sent to the REST API run as background jobs.
unsupported_media_type
HTTP 415. Send application/xml, application/pdf or application/json.
unsupported_encoding
HTTP 415. The document is not UTF-8 (for example UTF-16, or another declared encoding). Save it as UTF-8.
unsupported_format
HTTP 422. The document is not a format this API reads. GET /v1/formats lists the formats. validate returns this as a finding with status unsupported.
unsupported_version
Reserved; not returned at present.
malformed_xml
HTTP 422. The file is not well-formed XML. Fix the syntax error at the reported position.
forbidden_xml_construct
HTTP 422. The XML contains a DOCTYPE, entity declarations or an xml-stylesheet instruction. E-invoices never need them and they are used in XML attacks. Remove them.
xml_too_deep
HTTP 422. Elements are nested deeper than 64 levels. Check the program that wrote the file.
xml_too_many_nodes
HTTP 422. The document has more than 200,000 elements. Split the invoice.
semantic_loss
HTTP 422. Converting or creating the document would drop data the target cannot carry. details lists the fields. Pass allowDataLoss=true only if that is acceptable. See Conversion.
target_data_required
HTTP 422. The target format needs data that EN 16931 does not carry and the request did not supply, for example the Facturae person and residence types or the KSeF annotations. details.missing names each field and the option that supplies it; details.issues lists invalid option values. These values are never guessed, and allowDataLoss does not skip the check. See Conversion.
source_invalid
HTTP 422. The source document is not valid, so it is not converted. details has the findings. Fix the source first.
conversion_output_invalid
HTTP 422. The converted document did not pass validation, so it is not returned. details has the findings.
unsupported_conversion
HTTP 422. This source cannot be converted to this target, or the target is not one the endpoint accepts. The message lists the targets.
invalid_invoice_data
HTTP 422. The invoice JSON (create) or the changed invoice (fix) does not match the EN 16931 model. details names the fields.
generated_document_invalid
HTTP 422. The created invoice fails the official rules of the target format, so it is not returned. Each finding names the JSON fields involved.
fix_not_allowed
HTTP 422. The fix request cannot be applied: more than 200 changes, nothing to change, a file that is not one of the fixable formats (for example KSeF FA(2)), a Facturae or FA(3) file without the format data needed to write it again, an unknown proposal id or field path, or changes to amounts, quantities, rates or VAT data without confirmAmounts=true. The message says which. See Fixing.
unsupported_rules_version
HTTP 422. The rules option names a rule-set version that is not available. The message lists the versions; latest always works.
pdf_no_embedded_invoice
HTTP 422. The PDF has no embedded invoice XML. A plain PDF is not an e-invoice. Upload the XML or a ZUGFeRD / Factur-X PDF.
invalid_pdf
HTTP 422. The PDF cannot be read.
invalid_spreadsheet
HTTP 422. The xlsx field of POST /v1/invoices/generate/csv is not a readable Excel workbook: not a ZIP file, password-protected, a binary .xlsb or old .xls file, or a part that unpacks beyond the size limits. Save the file as .xlsx (Excel Workbook) and send it again.
rate_limited
HTTP 429. Too many requests per minute for this key. Wait for Retry-After. See Rate limits.
daily_limit_reached
HTTP 429. The free validator's daily limit per client is used up. Create a free account for an API sandbox.
widget_session_used_up
HTTP 429. The widget session has used all its checks (maxDocuments). Create a new session.
connector_failed
HTTP 502. The accounting system behind a connector (lexoffice, sevDesk, Odoo) returned an error during a sync. The message is that system's error. Check the token and settings of the connector.
validator_unavailable
HTTP 503. The official validator is not reachable at the moment. Retry with backoff.
internal_error
HTTP 500. Unexpected error. It is logged. Retry; contact support with the request id if it persists.
Dashboard, sign-in and billing codes
These come from the dashboard and its pages, not from /v1 with an API key.
not_signed_in
HTTP 401. The dashboard session is missing or expired. Sign in again.
invalid_email
HTTP 400. The e-mail address for sign-in is not valid.
invalid_token
HTTP 400. The sign-in link is invalid or has expired. Request a new one.
sign_in_unavailable
HTTP 503. Sign-in e-mails cannot be sent at the moment. The free validator and the documentation work without an account.
csrf
HTTP 403. A dashboard request without the expected header or from another origin.
forbidden
HTTP 403. The action needs the owner or an admin (billing, clients, webhooks, settings, partner customers) or the owner only (deleting all documents).
no_organization
HTTP 403. The user has no active organization.
storage_off
HTTP 400. The client queue, creating invoices and imports in the dashboard need stored documents. Set a retention of at least one day in Settings.
duplicate
HTTP 409. A bureau client with this name already exists.
expired
HTTP 410. A client request link has expired. Ask your accountant for a new one.
revoked
HTTP 410. The accountant withdrew this client request link. Ask your accountant if you still need it.
not_revocable
HTTP 409. Only open client requests can be withdrawn; this one was already answered, withdrawn or has expired.
sync_running
HTTP 409. A sync of this connection is already running (started by hand or by its schedule). Wait a few minutes and look at the last result. See Automatic sync.
plan_not_available
HTTP 400. This plan cannot be bought at the moment.
already_subscribed
HTTP 409. There is already a subscription. Change the plan instead.
no_subscription
HTTP 409. There is no active subscription to change. Choose a plan first.
same_plan
HTTP 409. The organization is already on this plan.
no_customer
HTTP 404. No subscription yet, so there is no customer portal. Choose a plan first.
billing_provider_error
HTTP 502. The payment provider returned an error. Try again later.
billing_not_configured
HTTP 503. Billing is not set up on this deployment (self-hosting).
invalid_signature, invalid_payload
HTTP 401 and 400. Returned by the payment webhook receiver of a deployment when the payment provider's webhook signature or body is wrong.
already_partner, application_pending
HTTP 409. Returned by the partner application in the dashboard: the organization is already a partner, or an application is already open. See partners.
unauthorized
HTTP 401. GET /metrics without the right METRICS_TOKEN (self-hosting).
Retries and idempotency
Send Idempotency-Key: <unique value> on every POST you may retry. For 24 hours:
- the same key with the same request returns the stored response (
Idempotent-Replayed: true) and is not billed again; - the same key with a different request returns
409; - requests that failed with 5xx or 429 release the key, so the retry runs.
Retry 429, 503 and 500 with exponential backoff. Do not retry other 4xx errors unchanged.
E-Invoicing API