KSeF

KSeF offline mode: the two QR codes (KOD I and KOD II)

How KSeF offline mode works, what KOD I and KOD II each mean on an offline invoice, and how a resilient integration retries without double-sending.

Published 3 min readBy Tomek

Overview

KSeF offline mode is the Ministry of Finance's contingency for invoicing while the platform is unreachable, and in KSeF 2.0 an offline invoice carries two QR codes: KOD I and KOD II. KOD I is the verification link generated by the issuer from the SHA-256 of the invoice XML and shows "OFFLINE" in place of the KSeF number until acceptance; KOD II is the issuer's verification QR signed with a KSeF certificate of type Offline and labelled CERTYFIKAT. The document must still be submitted to KSeF afterwards, within the window set by the Ministry.

Why offline mode exists

KSeF (Krajowy System e-Faktur) is Poland's national e-invoicing platform operated by the Ministry of Finance (Ministerstwo Finansów). When the platform or your connection to it fails, business does not stop, so the Ministry publishes a fallback procedure. In that procedure the invoice is issued outside the system and then sent to KSeF once the system is back, so the document still ends up in the official register with a KSeF number and a UPO.

KOD I and KOD II on an offline invoice

These are two different QR codes, not two states of one code. KOD I is the verification link for the invoice: the issuer generates it from the SHA-256 hash of the exact XML bytes, in both the online and the offline flow — KSeF does not return it. The link follows the pattern https://{host}/invoice/{seller NIP}/{issue date}/{hash}, and it does not carry the KSeF number in the URL. On an accepted invoice the text under the QR shows the KSeF number; on a document that has not yet been accepted it shows "OFFLINE". KOD II is the issuer's verification QR, signed with a KSeF certificate of type Offline and labelled CERTYFIKAT, and it verifies the issuer via a /certificate/ link; it appears as the second QR on an offline document, always alongside KOD I — nothing is later replaced.

How to handle an outage safely

Keep the invoice in a queue with a stable idempotency key, retry the submission with backoff, and never submit the same document twice because a timeout made the outcome unclear. The moment you receive the KSeF number and UPO, the invoice has officially entered the system; before that, the document is still pending.

Where Notaly fits

An API such as Notaly's owns the queue-and-retry side for you: you send the invoice once and it reports the status and UPO through a webhook. Notaly generates the KOD I QR for the invoices it submits (from the SHA-256 of the XML it sent), but it does not emit offline documents today. If KSeF is unreachable, Notaly keeps the invoice pending and retries with backoff; you get the final status by webhook.

FAQ

What is the difference between KOD I and KOD II? KOD I is the issuer's verification link built from the SHA-256 of the invoice XML and shows "OFFLINE" until acceptance; KOD II is the issuer's verification QR signed with a KSeF certificate of type Offline.

Can I keep invoicing when KSeF is unavailable? Offline mode exists for that, but confirm the current submission window and rules with the Ministry's procedures before relying on it.

Disclaimer

Notaly is not a tax, accounting or legal advisor. This article is general information, not tax advice, and may be outdated. You are responsible for your own VAT compliance; confirm with a qualified accountant where required.

Sources

Source: www.podatki.gov.pl

Frequently asked questions

What is the difference between KOD I and KOD II?

KOD I is the verification link generated by the issuer from the SHA-256 of the invoice XML; before acceptance it shows 'OFFLINE' instead of a KSeF number. KOD II is the issuer's verification QR signed with a KSeF certificate of type Offline and labelled CERTYFIKAT, added on an offline invoice.

Can I keep invoicing when KSeF is unavailable?

Offline mode exists for that, but the submission window and the exact rules come from the Ministry of Finance. Confirm the current rules before relying on it.

How do I avoid sending the same invoice twice?

Queue the invoice with a stable idempotency key, submit it once KSeF is reachable, and treat the KSeF number as proof it entered the system.

Issue your first KSeF test invoice today

Create a sandbox account: API key in seconds, 3 free test invoices on KSeF TEST, no credit card.