The SDI invoice gets rejected: common causes and fixes
Symptom
The call to create-xml (or the linked SdI submission) returns a JSON error instead of the expected
XML/outcome, or the document is rejected before it’s sent.
Causes
- Tax regime mismatch — if both the payload and the account have
tax_regimeset, the two values must match. If they don’t, generation fails. - Credit note on a free plan — free plans cannot create credit notes (
type: credit_note). - Credit note without a reference to the linked invoice — credit notes require
connected_invoice_data.idandconnected_invoice_data.dateto be populated. - Missing recipient routing — either
transmitter_data.sdi_codeortransmitter_data.recipient_pecis required; without one of the two, the submission cannot be routed. - Incomplete payload — required fields missing in the shared payload (e.g. supplier/customer data,
document total, at least one line in
order_items).
Fix
- Check the
tax_regimeconfigured on the account (POP panel) and align it with the one sent in the payload, or omit the field from the payload if it’s not necessary. - If you’re generating a credit note, check the active plan and the presence of
connected_invoice_data.id/date. - Check that the payload contains
sdi_codeorrecipient_pecfor the recipient. - Re-read the JSON error response: the message indicates which validation failed — no need to guess, the response body is the primary source.
- Try again in sandbox first (see use-sandbox-environment) to isolate the problem without touching production data.
Related configuration
For the canonical payload field names and documented error codes, see api/sdi.