KSeF in company software: generating invoices, matching transfers, OCR and AI – and what the law requires
Since 2026 an invoice in Poland is an XML file in KSeF, the National e-Invoicing System. For a company this is more than a new way of sending: invoices can be produced from the system's own data, transfers can be matched to them automatically, and AI can take care of what KSeF does not cover. This guide collects the KSeF dates and rules, shows what an integration must handle, how to link invoices with payments, where OCR and AI really help, and what the AI Act and the GDPR require of companies.
As of 25 November 2026. Sources: the Ministry of Finance KSeF 2.0 handbooks (August and November 2026), the Polish VAT Act, the KSeF and European Commission websites. This is an overview for companies, not legal or tax advice – check the details of your case with your accountant or adviser.
KSeF in 2026 and 2027 – who and from when
KSeF 2.0 has been running since 1 February 2026 (KSeF 1.0 was switched off the same day). The obligation came in stages, and the last stage falls on 1 January 2027.
-
1 February 2026
Companies whose 2024 sales exceeded PLN 200 million (including VAT) issue invoices in KSeF. From that day all taxpayers receive invoices through KSeF – except buyers to whom invoices are delivered in an agreed way, e.g. consumers and foreign companies.
-
1 April 2026
The obligation to issue covers all other companies.
-
Until 31 December 2026
Invoices may still be issued outside KSeF if their total gross value in a given month does not exceed PLN 10 thousand, and so may invoices from a cash register.
-
1 January 2027
All invoices, whatever the sales value, must be issued in KSeF. From that day active VAT payers also put the invoice's KSeF number in the transfer that pays it (more in the part on payments).
-
Penalties
The Act provides a fine of up to 100% of the VAT on the invoice, and up to 18.7% of the amount due for an invoice without VAT – for issuing outside KSeF, issuing an invoice that does not match the schema during a failure, or sending it to KSeF late. Under the law in force, the fines apply from 1 January 2027. In November 2026 the Sejm passed an act postponing them to the end of 2027; at the time of writing it has not yet been published. Liability under the Fiscal Penal Code remains.
-
Offline modes
offline24 can be used at any time – the invoice must reach KSeF by the next working day at the latest. During announced KSeF unavailability: 1 working day after it ends. During a KSeF failure: 7 working days after it ends. During a total failure, announced in the media, invoices are not sent at all.
Documentation
- KSeF: od kiedy trzeba wystawiać faktury
- The last stage of KSeF – changes from 1 January 2027 (MF, 16.11.2026, Polish)
- Invoicing modes – Ministry of Finance table (Polish)
- offline24 mode (Polish)
- KSeF 2.0 handbook, part I – getting started (Polish)
- Government bill postponing the penalties – Sejm print no. 3245 (Polish)
A KSeF integration in your software – what it must handle
There are three ways into KSeF: by hand in the free KSeF taxpayer app, through accounting or ERP software with KSeF built in, or through your own integration with the KSeF 2.0 API in the system the company already works in – a CRM, a shop, an order or billing system. An integration has to do much more than "send the file":
- Authenticate the company: a KSeF token, a KSeF certificate or a qualified seal or signature. For systems that run without a person, a certificate or a token fits best.
- Build the invoice in the FA(3) structure – in force since 1 February 2026 – and validate it against the schema before sending.
- Send it in a session, read the status and, once accepted, store the KSeF number and the official receipt (UPO) with the invoice in the system.
- Handle rejections: the message from KSeF goes to a person, and the corrected invoice is sent again – without any risk of one sale being sent twice.
- Offline mode: an invoice issued without a connection gets two QR codes and reaches KSeF within the deadline of the announced mode.
- Download purchase invoices: the date of receipt is the date the KSeF number is assigned, so the system should fetch them regularly, not "when someone remembers".
- Permissions: an accounting office gets access to invoices in KSeF and downloads the client's sales and purchases itself; it can also be allowed to issue.
- Test on the Ministry's environments: TEST for checking the integration, DEMO configured like production, and only then production – invoices with full legal effect.
-
Tokens and certificates
The Ministry of Finance has decided that KSeF tokens stay for an indefinite time – a token works until the user revokes it (the regulation is to be amended). KSeF certificates are valid for at most 2 years: type 1 is for signing in, type 2 for signing the second QR code on offline invoices. Certificates cannot be used in the free Ministry app – only in software that uses the API.
-
QR codes on the printout
An invoice shown outside KSeF – as a PDF, on paper, to a customer without KSeF access – must carry a verification code. An online invoice has one code with the KSeF number underneath; an offline invoice before it gets its number has two: OFFLINE and CERTYFIKAT. The codes are generated by the software, not by KSeF.
-
Attachments
FA(3) allows an attachment to an invoice, but only after filing the ZGL_ZAL notice in e-Urząd Skarbowy, and only for data that is complex in quantities, units or prices – typically utilities. A price list, warranty or manual is not a KSeF attachment.
-
Ready-made libraries
The Ministry publishes an integrator guide, an API changelog and client libraries for .NET and Java. Follow the changelog – the API keeps developing, and the handbooks get new versions.
Documentation
- Support for integrators – KSeF website (Polish)
- KSeF 2.0 API documentation (production)
- Integrator guide – CIRFMF/ksef-docs
- TEST, DEMO and PROD environments
- .NET client library
- The FA(3) logical structure (Polish)
- QR verification codes (Polish)
- KSeF 2.0 handbook, part II – issuing and receiving invoices (Polish)
- KSeF 2.0 handbook, part III – additional features, November 2026 (Polish)
Generating invoices from company data
The biggest saving is not in sending to KSeF itself, but in nobody retyping data into an invoicing program. The invoice is produced from what the system already knows:
- The source: an order from the shop, a job done by the service team, a subscription contract, hours from time tracking, a project milestone in the CRM.
- Templates and recurring invoices: a subscription or a fixed monthly invoice is produced on its own, and a person only approves it.
- Numbering without gaps: the number is given when the invoice is issued and kept for good, also when KSeF rejects the invoice and it has to be corrected.
- Frozen data: on issue the invoice copies the seller's and buyer's data. A later change of the customer's address does not change an issued invoice, and the XML is the same every time.
- Sending through a queue: the system records "to be sent" in the same transaction as the invoice, and a separate process sends it to KSeF and asks for its status. A failure or restart neither loses the invoice nor sends it twice.
- After acceptance: the KSeF number and the UPO come back to the system, and the customer and the accounting office get a PDF with the QR code and the original XML.
-
An invoice in KSeF does not change
An accepted invoice cannot be edited or deleted. Every change is a corrective invoice pointing to the KSeF number of the corrected one. The system should allow only that direction: a correction instead of an edit.
-
Customers outside KSeF
A consumer or a foreign company will not collect an invoice from KSeF. They get its visualisation – a PDF with the QR code – by e-mail or in a customer portal, and the invoice is in KSeF all the same.
-
Checks before sending
Most rejections are about data, not technology: a wrong tax ID, a missing field required for a given VAT rate, an invalid date. Validation in the system before sending saves corrections after a rejection.
Linking invoices with transfers
An invoice from KSeF has an unambiguous number, and from 1 January 2027 active VAT payers must put it in the transfer – both in ordinary transfers between companies and in split payments. That opens the way to settling receivables automatically. The system downloads bank statements and matches incoming payments by rules, starting with the most certain:
- The invoice's KSeF number or a collective identifier in the transfer title. KSeF issues a collective identifier for several invoices paid with one transfer.
- A virtual account: each customer – or each invoice – gets its own account number to pay into, and the bank itself tells you who paid.
- The invoice number in the title and a matching amount.
- The counterparty's account or tax ID and an amount matching one of their open invoices.
- The rest goes to manual assignment – or to an AI assistant that proposes a match (see the part on OCR and AI).
-- Step 1: incoming payments with an open invoice's KSeF number in the title
SELECT p.id AS payment_id, i.id AS invoice_id, p.amount, i.amount_due
FROM bank_payments p
JOIN invoices i ON position(i.ksef_number IN p.title) > 0
WHERE p.matched_at IS NULL
AND i.status IN ('unpaid', 'partly_paid');
-- Every match is stored as a new receivables entry (who, when, by which rule),
-- and the invoice's state is computed from the entries - we never overwrite a "paid" field.
-
Partial and collective payments
One invoice paid in instalments, one transfer for several invoices, an overpayment, a deducted note. Receivables kept as entries – payment, assignment, correction – instead of a single "paid" field show at any moment where a customer's balance comes from.
-
Statements and bank access
Banks provide statements in MT940 and, more and more often, camt.053 (ISO 20022), which replaces MT940 and has more room for payment details. A statement can be downloaded as a file from corporate banking or through the bank's API.
-
Before paying a purchase invoice: the white list
When more than PLN 15 thousand is paid to an account that is not on the VAT taxpayers' list, the amount is not a tax-deductible cost and the buyer is jointly liable for the seller's VAT – unless they notify the tax office within 7 days or pay with split payment. The account should be checked automatically before the transfer is prepared.
-
Split payment (MPP)
Mandatory when an invoice's gross value exceeds PLN 15 thousand and it covers goods or services from Annex 15 to the VAT Act. The transfer message carries the invoice's KSeF number. The system can flag such invoices itself and prepare the right transfer.
-
Reminders and collection
Once the system knows what has been paid, it can send reminders about upcoming and missed due dates on its own – and will not send one to a customer who paid yesterday.
OCR and AI – where they really help
An invoice from KSeF is structured XML: amounts, rates, tax IDs and dates are in fields, so it needs neither OCR nor AI. Paradoxically, KSeF moves AI to where documents are still unstructured – and to where a decision needs several sources matched at once.
- Rules first: everything that can be matched unambiguously – the KSeF number, a virtual account, the amount and invoice number – is done by code, without AI.
- AI gets only the rest and proposes: a match, a cost category, the fields it read – with a confidence level and a short reason ("title says FV 12 and 13, the amounts add up").
- A person approves. Always for payments and bookkeeping; for simple, repeated cases automatic approval above an agreed confidence threshold can be allowed – with a sample checked.
- Every decision is recorded: what the model proposed, who approved or corrected it, when. A person's corrections are the best material for improving the rules.
- AI sends nothing on its own: neither an invoice to KSeF nor a transfer to the bank. That stays with the system and people with the right permissions.
- Measure accuracy on a sample every month. A model that was 95% accurate in March need not be in October, when a supplier or a document format has changed.
-
Documents outside KSeF
Invoices from foreign suppliers, receipts and bills from business trips, documents from entities outside KSeF, invoices from before 2026, contracts, orders and transfer confirmations as PDFs. Here OCR with a language model reads the fields and proposes data for approval.
-
Difficult transfers
"For FV 12 and 13 minus the note", an advance without a number, a transfer from another company in the group, an amount after a fee was deducted. Rules will not match them, but a language model puts the title, amount, counterparty and open invoices side by side and proposes an assignment.
-
Spotting irregularities
A supplier suddenly gives a different account number, the same invoice arrives a second time, an amount differs from the usual, the account is not on the white list. These are typical traces of "changed bank account" fraud – the system holds such invoices for a person to check.
-
Cost descriptions and booking
A proposed cost category, cost centre or project based on the invoice lines and the history of similar purchases. The accountant approves with one click instead of typing from scratch.
What companies using AI must meet
AI in documents and finance is not only technology. Companies are bound by the AI Act and the GDPR, and in practice also by their own security rules and trade secrets.
-
The AI Act – dates
Prohibited practices and the duty to look after AI literacy – from 2 February 2025. General-purpose models – from 2 August 2025. The transparency duties of Art. 50 – from 2 August 2026. High-risk systems in Annex III – after the Digital Omnibus amendment, in force since 27 July 2026, from 2 December 2027; systems in Annex I products – from 2 August 2028.
-
Is invoice handling high-risk?
Reading invoices, matching payments or proposing bookings are not on the list of high-risk areas in Annex III. High-risk does include, among others, assessing the creditworthiness of natural persons (except for detecting fraud) and AI in employment and evaluating workers. If the same system is to assess individual customers or people in the company, the requirements grow.
-
AI literacy in the team (Art. 4)
Providers and companies using AI are to take measures to support the AI literacy of their staff. The Digital Omnibus softened the wording – no specific level has to be guaranteed – but the duty remains. In practice: training on what the tool does, where it gets things wrong and what it must not be trusted with.
-
Transparency (Art. 50)
If a customer talks to an AI assistant – e.g. in a payments portal – they must know it is AI. Content generated by AI is to be marked appropriately.
-
The GDPR
Invoices of sole traders and receipts contain personal data. The model provider processes them on the company's behalf, so you need a data processing agreement, knowledge of where the data is processed, and certainty it will not be used to train the model. The Polish data protection authority (UODO) publishes question lists for checking an AI tool, including a short version for SMEs using ready-made tools.
-
Rules in the company
A written policy: which AI tools are allowed, what data must not be pasted into public chats, who approves AI decisions in finance, how long results are kept. Most leaks are not attacks, but an invoice pasted into a free chat.
-
AI Act penalties
For prohibited practices up to EUR 35 million or 7% of worldwide turnover, for other obligations up to EUR 15 million or 3%, for misleading information up to EUR 7.5 million or 1%. For SMEs the lower of the two amounts applies.
Documentation
- Regulatory framework for AI – European Commission (dates, Digital Omnibus)
- AI Act, Annex III – high-risk areas
- AI Act, Art. 99 – penalties
- Text of the Digital Omnibus agreement (Council of the EU, doc. 9247/26)
- EDPB Opinion 28/2024 on AI models and the GDPR
- UODO – before you deploy an AI tool (Polish)
What we can do for your company
We build software from the company's processes, so we plug KSeF, payments and AI in where the data is created – not as a separate program someone retypes invoices into.
-
A KSeF integration in your system
Issuing invoices from orders, contracts, subscriptions or hours worked, sending through a queue with retries, corrections, PDFs with the QR code, downloading purchase invoices and access for the accounting office.
-
Receivables and transfer matching
Statement import or a bank connection, matching by KSeF number, virtual account and amount, partial and collective payments, due-date reminders.
-
Purchase invoice workflow
Download from KSeF, approval by the right person, white list and split payment checks before paying, a batch of transfers for the bank, export to the accounting office.
-
An AI assistant with human approval
Reading documents from outside KSeF, proposed matches for difficult transfers and bookings, spotting changed account numbers and duplicates – with every decision recorded and no right to send anything on its own.
-
AI training and rules
Training the team to use AI safely and help writing the company's rules – which is also part of the AI literacy Art. 4 of the AI Act talks about.
Checklist
Before KSeF, payments and AI start working together:
- You know from when the obligation applies to your company and have a plan for the offline modes – who issues, who sends later, by when.
- You have chosen how to authenticate (a token or a certificate) and someone who revokes it when the team changes.
- The accounting office has the KSeF permissions it needs – and not one more.
- The integration has passed tests on TEST and DEMO, including a rejection, a correction and the offline mode.
- Invoice visualisations for customers outside KSeF carry a QR code.
- Outgoing transfers from 2027 carry the KSeF number; incoming ones are matched by KSeF number, and the rest goes to a queue to be resolved.
- The supplier's account is checked on the white list before every payment above the threshold.
- AI has a written scope: what it proposes, who approves, what is recorded – and a data processing agreement with the model provider.
- The team has been trained on the AI tools it uses.
Tell us about your process
We reply within one working day. The first conversation about your process is free, and we prepare every quote individually.
Tell us about your process