Skip to content

KSeF integration with your ERP and invoice approval workflow

B2Bnetwork team · · 7 min

Integrations, data and cloud

In brief

Integrating KSeF, Poland's national e-invoicing system, with an ERP means a sales invoice leaves the ERP for KSeF without manual uploads, and its KSeF number and UPO (official receipt) come back to the ERP document. Purchase invoices are downloaded from KSeF automatically, recognized by their KSeF number and routed for approval before anyone posts them. The connector must also track offline invoices waiting to be sent, KSeF permissions, and the KSeF number that must appear in bank transfers from January 1, 2027.

Where to put the KSeF connector

The connector is the program that talks to the KSeF API on the company's behalf: it sends invoices, receives statuses and downloads purchase invoices. It can run in three places.

Where the connector runsWhen it fitsWhat to watch
ERP vendor's moduleone ERP, standard processeshow quickly it is updated after KSeF API changes, no control over the queue and alerts
Separate service between ERP and KSeFseveral sales systems, several companies, your own document workflowit has to be maintained and monitored like any integration
Document workflow systempurchases handled outside the ERP, complex approvalssales and purchases in two places, risk of two sources for the KSeF number

A company with one ERP and a few hundred invoices a month usually picks the vendor's module. A group of several companies with separate sales systems more often builds a separate service, because then the queue, retries and alerts live in one place. An overview of KSeF requirements and deadlines is in KSeF: how to prepare company systems.

Sales: from ERP document to KSeF number

  1. Issuing in the ERP. The document is created as before, but the connector immediately validates it against the FA(3) schema. A schema error goes back to the person who issued the invoice instead of waiting until evening.
  2. Sending. The connector sends the invoice within a session and stores the submission ID on the document, so after an interruption it knows what has already gone.
  3. Status and KSeF number. Once accepted, KSeF assigns the invoice a number. The connector writes it to the ERP together with the UPO, the official confirmation of receipt. Without the number on the document you cannot later link the invoice to a payment or a credit note.
  4. Rejection. An invoice rejected by KSeF lands on a fix list with the error message. It must not sit in the ERP marked as "sent".
  5. Visualization for the customer. A customer outside KSeF, a foreign one for example, gets a PDF with a QR code that lets them verify the invoice in KSeF.

When KSeF or the connection is down, the invoice is issued in offline mode and has to be sent later. According to the Ministry of Finance, in offline24 mode the invoice must reach KSeF no later than the next business day after it was issued, and in emergency mode no later than 7 business days after the outage ends. The connector therefore needs a queue of offline invoices with an alert as the deadline approaches.

Purchases: from download to approval

Since February 1, 2026 all Polish VAT taxpayers receive invoices through KSeF, and the moment of receipt is the date the invoice was accepted into the system, shown in the UPO. The invoice is "with the company" before anyone has seen it. The purchase workflow looks like this:

  1. The connector downloads new invoices where the company is the buyer every few hours.
  2. It discards duplicates by KSeF number, because the same invoice can come back in the next download.
  3. It recognizes the supplier by tax ID and checks that it has a master record in the ERP.
  4. It links the invoice to the purchase order and goods receipt, if they exist in the ERP.
  5. It routes the invoice to the person who approves the cost: the department head, the contract owner or the warehouse.
  6. After approval, the invoice goes to posting and into the payment queue with its KSeF number.

Some invoices will still arrive outside KSeF: from foreign suppliers, from cash registers (they can be issued without KSeF until the end of 2026), and from small taxpayers who until December 31, 2026 may invoice outside KSeF up to 10,000 PLN of sales including VAT per month. The workflow must accept these alongside KSeF invoices, marked with their source. Matching an invoice to the order and goods receipt can be handled by the Purchase invoice checker, an AI Worker from DYNAMINDS Labs. It leaves posting and supplier claims to a person, as described in more detail in An AI Worker for KSeF invoices.

Permissions, certificates and the technical account

The connector should not run on the chief accountant's permissions. It is better to grant separate KSeF permissions for issuing and viewing invoices, assigned to the integration, and to record who granted them and when they expire. KSeF 2.0 accepts several authentication methods, including KSeF certificates: a type 1 certificate is used for authentication and a type 2 certificate for the QR codes of offline invoices. Tokens from KSeF 1.0 do not work in the new version.

In practice, watch three things: certificates and tokens live in a secrets vault, not in a configuration file; the certificate expiry date has an early alert; and the departure of the employee who granted permissions does not stop the integration.

Payments: the KSeF number in transfers from 2027

The Ministry of Finance confirms that Article 108g of the Polish VAT Act applies to payments made from January 1, 2027, including payments for invoices issued earlier. When the buyer is an active VAT taxpayer, a payment for a KSeF invoice must carry the KSeF number or a collective identifier covering several invoices, and a split payment (the Polish MPP mechanism) for several invoices in one transfer always carries a collective identifier. With several invoices in one transfer the character limit of the payment title matters, so sometimes it is better to pay each invoice separately. Invoices issued in emergency mode are exempt from this obligation.

For the integration, this means the KSeF number must travel from the ERP to the payment file or the bank API. How a company exchanges transfers and statements with its bank is covered in Business bank integration.

Testing before cutover and after every change

The Ministry provides a test environment, a pre-production environment (Demo) and the production KSeF 2.0 API. The regression set should cover at least: a standard invoice and a credit note, an invoice in a foreign currency, an advance invoice, a rejection by KSeF, an offline invoice sent after an outage, downloading the same purchase invoice twice, and a payment with a KSeF number. The course of such tests in a finance and accounting system is shown in the case study on testing a KSeF rollout at a debt collection company.

B2Bnetwork engineers build KSeF connectors, offline invoice queues and monitoring as part of our System integration service, including when invoices are issued in several systems across a group.

Questions and answers

Is the ERP's KSeF module enough, or do I need a separate integration?

With one ERP and a standard process, the vendor's module is usually enough, as long as it shows the offline invoice queue, rejections and alerts. A separate service makes sense when invoices are issued in several systems or companies, when purchases go through a document workflow system, or when the module gives no view of what got stuck.

When is a purchase invoice from KSeF considered received?

On the date it was accepted into KSeF, as shown in the UPO, not on the day someone opened it. That is why invoice downloads should run automatically several times a day, and the approval workflow should count payment terms from the KSeF date.

What should I do with invoices that still arrive outside KSeF?

Route them into the same approval workflow, marked with their source: a PDF from email, a foreign invoice, a cash register invoice. Until the end of 2026 there will be more of them, because transition periods for cash registers and small taxpayers are still running. The workflow must not assume that every invoice has a KSeF number.

Does every bank transfer need a KSeF number?

From January 1, 2027, payments for KSeF invoices must carry it when the buyer is an active VAT taxpayer. A split payment covering several invoices in one transfer carries a collective identifier. Emergency mode invoices are exempt. The safest setup is for the KSeF number to reach the payment file automatically from the ERP rather than being retyped by hand.

What it looks like in a project

Connecting systems or moving them to the cloud? Talk to an architect.

Let's talk

Read more: Integrations, data and cloud

All in Integrations, data and cloud →