Error codes · ksef · Poland

KSEF-21401In your invoicing software

Document does not conform to the KSeF XSD schema

This is the rejection, word for word: „[KSEF-21401] KSeF error 21401 ("Dokument nie jest zgodny ze schemą (xsd)") is returned when the invoice payload fails XSD schema validation against the FA schema published by the Polish Ministry of Finance. The API rejects the payload before any business validation runs, so no reference number is issued and the invoice is not stored.“

The KSeF ingestion pipeline validates every submission against the currently active FA schema (FA(2) or FA(3) for KSeF 2.0). Validation happens synchronously on /online/Invoice/Send and asynchronously on batch endpoints. When it fails, the API returns HTTP 400 with exceptionCode 21401 and, when available, an exceptionDetailList of XPath locations and XSD messages.

What to have readyNothing. The file has to be re-exported from your invoicing software; we check it again afterwards.
What we doRegenerate the invoice against the exact FA schema version declared in the session header, fix each schema violation using the exceptionDetailList (missing required elements, wrong data types, wrong element order, unknown namespaces), and resubmit.
What the finding looks likeExample
FindingStructure invalid · KSEF-21401
From youA re-exported file
ThenRe-export
ProofSHA-256 and /verify link after the check