Skip to content

KSeF: how to prepare company systems for Poland's National e-Invoicing System

B2Bnetwork team · · 6 min

Regulations

In brief

KSeF (Poland's National e-Invoicing System) is already mandatory: since February 1, 2026 every business receives invoices through it, large companies have issued invoices in it since February 1 and all others since April 1, 2026. Your systems must send invoices in the FA(3) schema through the KSeF 2.0 API, download purchase invoices, handle offline modes and store certificates. Penalties for KSeF errors were deferred to January 1, 2027, so now is a good time to review the integration.

Deadlines in force today

Status according to the Ministry of Finance KSeF portal, ksef.podatki.gov.pl, on the publication date:

FromWhoWhat
February 1, 2026all taxpayersreceiving invoices through KSeF
February 1, 2026companies with 2024 sales above 200 million PLN (including VAT)issuing invoices in KSeF
April 1, 2026all other taxpayersissuing invoices in KSeF
until December 31, 2026taxpayers with small salesinvoices outside KSeF, if total sales including VAT on such invoices do not exceed 10,000 PLN in a month
January 1, 2027everyoneend of the deferral of penalties for KSeF errors

KSeF deadlines have been moved several times, so check the current “Od kiedy trzeba wystawiać faktury w KSeF” page before any design decision. Consumer (B2C) invoices are not covered by the mandate: issuing them in KSeF is voluntary.

What your systems must be able to do

KSeF turns an invoice from a document sent to the customer into an XML message submitted to a government system. For the IT team, it is above all a new integration with strict timing rules.

  • Sending in the FA(3) schema. The FA(3) logical structure has applied since February 1, 2026. The ERP, billing system or online store must generate valid XML and validate it before sending, not only after a rejection.
  • Issue date. An invoice in online mode counts as issued on the day it is sent to KSeF, and the date in field P_1 must match the date the file was sent. An invoice generated at 11:58 p.m. and sent after midnight is a real defect your sending queue has to anticipate.
  • KSeF number and UPO. Every accepted invoice gets a KSeF number, and the official confirmation of receipt (UPO) contains that number and the acceptance date. The system stores both with the document, because the KSeF number also goes into payment references.
  • Receiving purchase invoices. An invoice counts as received when it is assigned a KSeF number, not when accounting opens it. You need scheduled downloads of invoices and a handover to document workflow or to automated posting.
  • Visualization with a QR code. An invoice given to a business partner outside KSeF, for example as a PDF, carries a QR code with the KSeF number below it.

Integration patterns (queues, idempotency, retries, data mapping) are covered in the article ERP integration: patterns and pitfalls. With KSeF, idempotency matters most: a retried send must never produce two invoices with the same internal number.

Offline modes and outages

KSeF provides for situations in which an invoice cannot be sent immediately. Each mode has its own deadline for submission:

ModeWhenDeadline for sending to KSeF
offline24the taxpayer's choice, for example a problem on their sideno later than the next working day after the issue date
KSeF unavailabilityannounced unavailability of the system, for example maintenanceno later than the next working day after the unavailability ends
KSeF failureannounced system failureno later than 7 working days after the failure ends

An offline invoice not yet sent to KSeF carries two QR codes: one labeled “OFFLINE” and one labeled “CERTYFIKAT”. The second requires a type 2 KSeF certificate. In practice the system needs a queue of offline invoices with an alert when the submission deadline approaches, and a report of which invoices are waiting.

Authentication, certificates and tokens

KSeF 2.0 accepts several authentication methods: Podpis Zaufany (the Polish trusted profile signature), a qualified electronic signature, a qualified electronic seal, tokens and KSeF certificates. For a system integration, three facts from the Ministry of Finance's official answers matter:

  1. A type 1 KSeF certificate is used for authentication, and a type 2 certificate for the QR codes of offline invoices.
  2. A certificate is valid for no longer than 2 years, so its renewal needs an owner and a reminder in the team calendar.
  3. Tokens from KSeF 1.0 do not work in KSeF 2.0, and the Ministry has kept tokens generated in the new version available indefinitely.

Certificates and tokens are secrets: keep them in a vault, not in the ERP configuration file, and grant permissions by role. How to do that is described in Secrets in applications: from an .env file to a vault.

Environments and integration testing

The Ministry provides three KSeF 2.0 API environments: integration (test, anonymized data only), the pre-production Demo (real permissions, but no legal effect) and production, where invoices have legal effect. Each publishes an OpenAPI contract, and the Ministry's GitHub hosts an integrator guide and libraries in C# and Java. The API has limits; with a genuine operational need you can request higher limits on Demo and production.

A test plan before January 1, 2027 is best built around risk:

  • sending: invoices with every line type, corrections, advance invoices, currencies, invoices with many lines;
  • timing: sending just before midnight, the queue after a network outage, retries after an API error;
  • offline modes: issuing in offline24, later submission, two QR codes on the printout;
  • receiving: downloading purchase invoices, duplicates, an invoice from a supplier with the wrong buyer tax ID;
  • permissions and certificates: an expired certificate, revoking permissions of someone who left;
  • performance: the month-end peak, when billing sends thousands of invoices in a few hours, taking API limits into account.

How such tests run in a finance and accounting system is shown in the project on KSeF implementation testing at a debt collection company. On the cost side, XML invoices received from KSeF are well suited to automated coding, which we cover in An AI Worker in accounting.

Questions and answers

Does a small business have to issue invoices in KSeF?

Yes, since April 1, 2026 the obligation also applies to small businesses. Until December 31, 2026 invoices may be issued outside KSeF, on paper or electronically, if total sales including VAT on such invoices do not exceed 10,000 PLN in a given month. Receiving invoices through KSeF has applied to everyone since February 1, 2026, so a small business needs access to the system anyway.

When do penalties for KSeF errors start?

According to the Ministry of Finance's answers on the KSeF portal, penalties for KSeF errors were deferred to January 1, 2027. Before that date it is worth fixing errors that currently go without consequences: offline invoices never submitted, mismatched issue dates, missing KSeF numbers in the records. Check the current announcements before planning, because KSeF deadlines have changed several times.

Do consumer invoices go through KSeF as well?

They do not have to. Issuing consumer (B2C) invoices in KSeF is voluntary both before and after February 1, 2026. An online store that sells to both businesses and private individuals therefore has to tell buyers apart and route business invoices to KSeF. That rule deserves its own test cases.

How does the KSeF test environment differ from Demo?

The integration environment is for testing with anonymized data, and its invoices have no legal force and are deleted after a while. The pre-production Demo environment works with real credentials and permissions, but also without legal effect. You build the integration on the test environment and run the dress rehearsal with real permissions on Demo.

What it looks like in a project

Preparing your systems for an audit? Talk to an engineer.

Let's talk

Read more: Regulations