BlogERP and data

KSeF ERP integration: what your ERP has to do, step by step

KSeF ERP integration in plain steps: build FA(3), send and keep the KSeF number, fetch purchase invoices, and put the number on payments from 2027.

Contents9
  1. KSeF ERP integration: why the ERP does the work
  2. Job 1: build an FA(3) file that KSeF accepts
  3. Job 2: send in the right kind of session
  4. Job 3: keep the KSeF number and the UPO
  5. Job 4: fetch purchase invoices, because nobody sends them to you
  6. Job 5: put the KSeF number on payments from 1 January 2027
  7. Who sends: permissions and logins
  8. What our KSeF tests show
  9. What to do next

In short

  • An invoice sent to KSeF exists only once KSeF gives it a KSeF number, so the ERP has to wait for that number and store it.
  • KSeF does not notify the buyer of new invoices, so the ERP has to ask KSeF for purchase invoices on a schedule.
  • From 1 January 2027 an active VAT taxpayer paying another active VAT taxpayer by transfer for a KSeF invoice must give its KSeF number or a collective identifier, so the number has to reach the payment run.

KSeF ERP integration covers five jobs, and sending is only one of them. Since 1 April 2026 most companies in Poland have to issue invoices in KSeF, and the smallest follow on 1 January 2027 [2]. For many of them the system that prepares the invoice is an ERP. This note, for whoever owns that ERP, goes through what it has to do with KSeF: build the file, send it, keep the answer, fetch purchase invoices, and carry the KSeF number into payments. Every rule below comes from the Ministry of Finance's pages, its KSeF 2.0 manual, its API documentation or the VAT Act, all read in Polish on 10 October 2026.

KSeF ERP integration: why the ERP does the work

The Ministry runs free tools, such as the Taxpayer Application, the mobile app and e-⁠mikrofirma. Its manual says they can be the main tool for a company, and they send invoices one at a time [2]. For a company that receives hundreds or thousands of purchase invoices a month, the manual says it is more efficient to fetch them from KSeF in bulk [2].

An older connection is not enough. The Ministry says a system integrated with KSeF 1.0 needs a new integration with KSeF 2.0, because API 2.0 brings the FA(3) structure with attachments, the offline24 mode and KSeF certificates [1]. Tokens generated in KSeF 1.0 do not work in KSeF 2.0 [1].

The Ministry offers three environments [4]:

EnvironmentDataLegal effect
Integration (test)Anonymised dataNone. Invoices are deleted after a time
Pre-production (Demo)Real login data and real permissionsNone. Invoices are deleted after a time
ProductionReal login data and real permissionsInvoices have legal effect

Test in the first two before the first live invoice. The Demo environment already needs real permissions of the same kind as production [4], so it also tests who in your company may send.

Job 1: build an FA(3) file that KSeF accepts

Since 1 February 2026 the structure is FA(3) [2]. KSeF checks every file against the schema declared when the session opens, and checks that whoever sends it has the permission to do so [2]. If either check fails, KSeF gives no KSeF number, which means the invoice has not been issued [2].

The Ministry lists Rozliczenie, Platnosc, WarunkiTransakcji, Stopka and Zalacznik as optional nodes [1]. Once the ERP fills an optional node, the required fields inside it have to be filled too, or the file is rejected [1]. A mapping that writes a payment node with only half its fields is one way to hit this.

The Ministry encourages software makers to check the XML against the schema before sending [2]. Do it in the ERP's export step. A file KSeF refuses with 430 or 450 gets no number and has to be corrected and sent again [3].

Job 2: send in the right kind of session

The API has two ways to send [2]:

  • An interactive session sends single invoices. Each file may be at most 1 MB, and invoices with an attachment cannot be sent this way, except a technical correction of such an invoice.
  • A batch session sends invoices packed in ZIP files. Each invoice may be at most 1 MB without an attachment and 3 MB with one. A batch session can carry at most 50 ZIP packages of up to 100 MB each. Invoices with an attachment can only be sent in a batch session, again except a technical correction.

In both, one session holds at most 10,000 invoices [2]. Before sending, the ERP encrypts the invoice. When a session opens, the API expects a 32-byte symmetric key, encrypted with the Ministry's public key using RSA with OAEP and SHA-⁠256, and a 16-byte initialisation vector [3].

FlowchartWhich session for which invoices
YesNoYesNoDoes the invoice have anattachment?Batch session, up to 3 MB perinvoiceDo you send invoices one at atime as they are made?Interactive session, up to 1 MBper fileBatch session, ZIP packagesAt most 10,000 invoices persession

A batch is not all or nothing. KSeF checks each XML file on its own, rejects only the faulty ones and gives the rest their KSeF numbers [2]. The ERP has to ask KSeF which files in the session were rejected, and mark each invoice by its own result, not by the result of the package [2].

In online mode the invoice's issue date is the day it is sent to KSeF. If it reaches KSeF later than the issue date in field P_1, the VAT Act treats it as an offline24 invoice [1]. Offline24 invoices have to reach KSeF by the next working day [1]. A night job that sends after midnight turns yesterday's online invoices into offline24 invoices.

The API also has rate limits. The Ministry publishes them in the API documentation [2][3], and a company with a real operational need can ask for higher limits in the Demo and production environments [4]. An answer of HTTP 429 means wait and send again.

Job 3: keep the KSeF number and the UPO

The KSeF number is the answer the ERP is waiting for. It is generated by KSeF and returned in the official receipt, the UPO [2]. A structured invoice counts as issued only once KSeF has given it that number [1]. The Ministry says keeping the UPO is not necessary, because the KSeF number already shows the invoice was processed [6], but it is useful proof.

Three details matter for the data model:

  1. The KSeF number is not part of the invoice. FA(3) has no field for it. The invoice carries your own number in field P_2 [2]. So the ERP needs its own place for the KSeF number, next to its own invoice number.
  2. The session's reference number is not the KSeF number [2]. Do not store it in place of the number.
  3. The UPO is a separate XML document, downloadable through the API [2]. It records, among other things, the KSeF number, the invoice number from P_2, the seller's NIP, the date sent, the date the number was given, a SHA-⁠256 hash of the invoice and whether it was sent online or offline [2].

The ERP needs the number for more than filing. Since the February 2026 returns, the JPK_V7M and JPK_V7K files must list the KSeF numbers of sales invoices issued and purchase invoices received, or the right marking where there is none [2]. A correction invoice gives the KSeF number of the invoice it corrects, in the DaneFaKorygowanej part of FA(3), unless that invoice never received one [2].

If you hand the buyer a PDF or a print, the copy needs a QR code. The Ministry says a visualisation passed on outside KSeF must carry one [6]. For an invoice issued online, that is one QR code with the KSeF number under it [6]. An offline invoice not yet sent to KSeF carries two: one marked OFFLINE and one marked CERTYFIKAT [1]. Software may design its own invoice, in another language too, as long as the content matches the XML in KSeF [1].

A clearance loopThe tax system checks each invoice and hands back an ID. Pick a country.

Step 1 / 5

The ERP data is mapped to an FA(3) file.

What can go wrong430 or 450: KSeF refuses the file or its content. The number is not registered and can be used again.

Job 4: fetch purchase invoices, because nobody sends them to you

An invoice with the buyer's NIP is available to the buyer in KSeF as soon as it has its KSeF number [2]. KSeF does not tell you. The manual says plainly that KSeF sends no notifications of new invoices, and that the program the company uses has to ask KSeF [2]. The seller cannot see whether you downloaded an invoice either, and you may download it as many times as you need [2].

KSeF has no way to refuse an invoice. Disputes are settled outside it, and the result shows up as a correction invoice [2]. So import every purchase invoice and leave approval to your own workflow.

The API gives two ways to fetch [3]:

  • A metadata query returns up to 10,000 records for one set of filters. The date range may cover at most 100 days. For an incremental download, the documentation says to filter by the date of permanent storage and to sort in ascending order.
  • An export builds an encrypted package of invoices in the background, with a file of their metadata. One package holds at most 10,000 invoices or 1 GB compressed, and at most 10 exports can run at once for the logged-in context.
FlowchartAn incremental download that does not miss invoices
NoYesNoYesAsk from the last permanentstorage date, ascendingMore results?Stop. Save the last dateList cut at 10,000?Next pageRestart from the last record'sdate

Run this on a schedule and store the last date you reached. The documentation says to use the permanent storage date for incremental downloads [3]. Fetching by issue date can miss invoices issued earlier and stored later, such as offline24 invoices.

Job 5: put the KSeF number on payments from 1 January 2027

Article 108g of the VAT Act says that a buyer registered as an active VAT taxpayer, paying another active VAT taxpayer for a structured invoice by transfer or another payment instrument that carries a payment title, must give the invoice's KSeF number or a collective identifier given by KSeF [5]. The same applies to offline24 invoices and to invoices issued while KSeF was unavailable [5]. It also applies to someone else paying on the buyer's behalf, and for a direct debit the duty sits with the issuer of the invoice [5]. Whether the payee is an active VAT taxpayer is checked against the official list of taxpayers on the day of payment [5].

The amending act that added article 108g applies it to payments made from 1 January 2027 [5]. From the same day, a split payment transfer has to carry the KSeF number of a structured invoice in place of the invoice number [2][6]. The Ministry gives the reason as fighting late payments [6].

There are exceptions. The duty does not apply to offline24 invoices and invoices issued during unavailability that are not yet in KSeF because of the Ministry's announcements of a KSeF failure [5]. The manual adds that invoices issued in failure mode are also outside it [2].

FlowchartDoes this transfer need a KSeF number from 2027?
NoYesNoYesAre payer and payee both activeVAT taxpayers on the paymentday?Article 108g does not applyFailure-mode invoice, or heldback by an announced failure?Give the KSeF number or acollective identifierSplit payment: the KSeF numbergoes in the transfer message

For the ERP, this means the payment run has to read the KSeF number from the purchase invoice record that Job 4 filled. If you pay many invoices in one transfer, ask KSeF for a collective identifier first [3][5].

Who sends: permissions and logins

Every call to KSeF runs under a login and a permission. Sending needs the right to issue invoices for your NIP, and fetching needs the right to read them [3]. An invoice sent without the right permission gets status 410, and a read call without it is refused with HTTP 403 [3]. Permissions granted in KSeF 1.0 do not carry over, apart from those granted on the ZAW-⁠FA form and the owner's own rights [1].

Decide early whose login the ERP uses, who grants that permission, and who renews it. The tokens and certificates themselves, and the dates around them, are covered in our note on KSeF penalties 2027.

What our KSeF tests show

We have run these steps in KSeF's own test environment. On 26 September 2026 an FA(3) invoice built from ERP-style data received a KSeF number and a UPO. Sending the same invoice again was refused as a duplicate, code 440. In another test, KSeF refused a file because of a byte-order mark at its start, code 430. The files and the replies, word for word, are on our evidence page. They are test runs with fictitious companies, not production traffic.

EurInvoice is not a KSeF operator or a licensed provider. We map the ERP's invoice data to FA(3), validate it and send it to KSeF with your company's own login and permissions.

What to do next

Go through the five jobs against your ERP and mark each one done, partly done or missing. Check two of them first: whether purchase invoices still arrive by e-⁠mail, and whether the payment run has a field for the KSeF number. Receiving has applied since 1 February 2026, and the payment rule applies from 1 January 2027.

The five jobs in one table:

JobWhat the ERP has to doWhy
1. Build FA(3)Check the XML against the schema before sendingA refused file gets no KSeF number, so the invoice is not issued
2. SendMark each invoice by its own result in the sessionA batch rejects only the faulty files
3. Keep the numberStore the KSeF number next to your own invoice numberFA(3) has no field for it, and JPK_V7M and JPK_V7K list it
4. Fetch purchase invoicesAsk KSeF on a schedule, by permanent storage dateKSeF sends no notifications of new invoices
5. PayCarry the KSeF number into the payment runNeeded on transfers between active VAT taxpayers from 1 January 2027, with exceptions

If a foreign or custom ERP has to reach KSeF, the Poland page shows how we work there. How it works gives the steps, pricing gives the fixed price for one entity, one source system, one route and one outbound invoice family, and Rejection Care covers rejections after go-live.

Questions

Can our ERP send invoices to KSeF with the old KSeF 1.0 integration?

No. The Ministry says an integration with KSeF 2.0 is needed, because API 2.0 brings FA(3), the offline24 mode and KSeF certificates. Tokens from KSeF 1.0 do not work in KSeF 2.0.

Does KSeF tell us when a supplier has issued an invoice to us?

No. KSeF sends no notifications about new invoices. The software you use has to ask KSeF for them.

Do we have to put the KSeF number in every bank transfer?

From 1 January 2027, when an active VAT taxpayer pays another active VAT taxpayer by transfer for an invoice issued in KSeF, the transfer must give its KSeF number or a collective identifier from KSeF. There are exceptions for offline invoices not yet in KSeF because of the Ministry's announcements of a KSeF failure.

Next stepSee how a case runs, step by stepHow it works

Sources

  1. Integratorzy IT: questions from software integrators (Ministry of Finance)ksef.podatki.gov.pl
  2. Podręcznik KSeF 2.0, część II: issuing and receiving invoices in KSeF (Ministry of Finance, August 2026)ksef.podatki.gov.pl
  3. KSeF API 2.0 documentation, production environment (Ministry of Finance)api.ksef.mf.gov.pl
  4. Wsparcie dla integratorów: KSeF 2.0 environments and API documentation (Ministry of Finance, updated 2 October 2026)ksef.podatki.gov.pl
  5. VAT Act, consolidated text, Dziennik Ustaw 2026 item 1263: art. 108gdziennikustaw.gov.pl
  6. Pytania i odpowiedzi KSeF 2.0 (Ministry of Finance, updated 8 October 2026)ksef.podatki.gov.pl

Also available in Български · Čeština · Dansk · Deutsch · Ελληνικά · Español · Eesti · Suomi · Français · Gaeilge · Hrvatski · Magyar · Italiano · Lietuvių · Latviešu · Malti · Nederlands · Polski · Português · Română · Slovenčina · Slovenščina · Svenska

Add as a preferred source on Google

Contact

Thirty minutes to test whether it fits the standard scope.

Bring one case. It helps to have:

  • Your ERP and version
  • The first country route and legal entity
  • An anonymised sample invoice and where the credentials stand

30-minute call

Choose a time

Choose a time