Skip to content

Processing KSeF e-invoices with an AI Worker: receiving, checking and describing them

DYNAMINDS Labs team · · 7 min

AI Workers

In brief

An AI Worker for KSeF invoices downloads new purchase invoices from KSeF (Poland's national e-invoicing system) several times a day, reads the fields of each XML file, checks the supplier's tax ID, prices, quantities and payment terms against the ERP, and prepares matching invoices for posting. Invoices with a discrepancy go to a separate list with a note on what does not match. Posting, supplier claims and approving an invoice without a goods receipt stay with a person.

What KSeF changed in receiving invoices

Since February 1, 2026, all VAT taxpayers in Poland receive invoices through KSeF. For a finance team this means three practical changes.

  • An invoice is a file with fields, not an image. The seller's tax ID (NIP), invoice number, dates, line items, VAT rates and payment terms sit in the FA(3) structure. Nobody has to read them off a scan, so a whole class of retyping errors disappears.
  • An invoice arrives when KSeF assigns it a number. Not when someone in accounting opens it. If nobody downloads invoices regularly, the payment term keeps running while the document sits in the government system.
  • Not everything comes through KSeF. Invoices from foreign suppliers, debit notes, bills and some documents from exempt businesses still arrive by email, usually as PDFs.

KSeF solves the reading problem, but not the checking problem. An XML invoice can carry the wrong price, a quantity higher than what was delivered or a payment term shorter than the contract says. Someone still has to compare it with the purchase order and the goods receipt. How to prepare the systems themselves for KSeF is covered in KSeF: how to prepare company systems.

An AI Worker's day with e-invoices

The Purchase invoice checker is an AI Worker from DYNAMINDS Labs that takes over this step. Its day looks like this:

  1. Download. Every few hours it pulls new purchase invoices from KSeF and records the KSeF number for each one. In parallel it reads the invoices@ mailbox, where foreign invoices arrive as PDFs.
  2. Identify the supplier. It looks up the seller's tax ID in the ERP vendor master. An unknown tax ID is a signal: a new supplier, a typo on the supplier's side or an invoice that should never have reached the company.
  3. Link to the purchase order. It looks for the order by the number on the invoice and, when there is none, by supplier, items and dates.
  4. Link to the goods receipt. It checks whether the goods were received into the warehouse on a goods receipt note (PZ in Polish ERP systems) and in what quantity.
  5. Checks. It compares tax ID, unit prices, quantities and payment terms with the order, the receipt and the supplier's terms.
  6. Description or discrepancy. A matching invoice gets a description for posting. A non-matching one goes to a list with a note on the difference.

In the morning the team gets two lists: invoices ready for posting and invoices with discrepancies. Each item links to the invoice, the order and the receipt, so the approver does not hunt for documents across systems.

Which checks it runs and what follows

The table below shows typical cases from purchase invoices and what the AI Worker does in each.

What it checksExample discrepancyWhat the AI Worker doesWho decides
seller's tax IDthe tax ID is not in the vendor masterdescribes the case, does not link the invoice to any orderaccountant
unit pricePLN 12.40 on the invoice, PLN 11.90 on the ordercalculates the difference per line and for the whole invoicepurchasing or accountant
quantity500 pcs on the invoice, 480 pcs on the receiptpoints to the missing 20 pcs and the receipt datewarehouse and purchasing
goods receiptinvoice present, no receiptmarks "no receipt", does not prepare it for postingapprover
payment term14 days instead of 30 from the contractrecords the term from the invoice and from the contract side by sidefinance
matching invoiceall fields agreeprepares the description for postingaccountant approves

The tolerance threshold is set by the company, not by the AI Worker. A difference of a few cents from rounding on a line can pass as a match, while a price difference above the agreed threshold always goes to the list. The threshold is written into the rules card at the start of the deployment and changed only on purpose.

Checking the supplier's bank account before a transfer is a separate step, described in The VAT white list and the supplier's account. The AI Worker prepares the invoice for posting, while payment and its controls stay in the payment process.

Describing the invoice for posting

For a matching invoice, the AI Worker prepares a description that the accountant sees next to the document. An illustrative example with made-up data:

KSeF:     purchase invoice, supplier: electrical materials wholesaler
order:    ZZ/2026/11/087, 3 lines, prices match
receipt:  PZ/11/0412 of Nov 24, quantities match
terms:    30 days, consistent with supplier terms
result:   ready for posting

The cost coding, meaning the account, cost center and VAT treatment, is the next step. For invoices for production materials it often follows directly from the order. For services and overheads you need another AI Worker that knows the company's chart of accounts, as described in Invoice coding with AI. The earlier step, matching an invoice to the order and receipt when deliveries are partial, is covered in Matching an invoice to the order and goods receipt.

Limits: what the AI Worker does not do on its own

The AI Worker has an ERP account with permission to read documents and write descriptions. It has no permission to post. Three decisions always wait for a person:

  • posting the invoice, because a person in the finance team is responsible for the accounting entry,
  • a price or quantity claim to the supplier, because it is an external message and part of the business relationship,
  • approving an invoice without a goods receipt, because it is an exception to the rule "we pay for what arrived".

Every step the AI Worker takes goes into a log: which invoice it downloaded, what it compared it with and why it considered it a match or not. The log helps in an audit and in a dispute with a supplier. This split is discussed further in Human in the loop.

You can see this split in the case study on describing and coding cost invoices at a factoring company: all invoices, including those from KSeF, go into one queue, and a person approves the proposals in a single view. DYNAMINDS Labs starts with a free diagnosis, and a pilot usually takes 4 weeks on the company's invoices from recent months, without connecting to its systems.

Questions and answers

Does the AI Worker need access to KSeF?

Yes. Downloading invoices requires a KSeF permission that the company grants to a technical account or to the ERP integration. For a pilot, an export of invoices from recent months as XML files is enough, so access is arranged only before deployment. The permission is limited to receiving purchase invoices.

What about invoices that do not come through KSeF?

The AI Worker reads them from the invoices@ mailbox, usually as PDFs. These are mostly invoices from foreign suppliers, debit notes and bills. Reading a PDF produces more uncertain fields than XML, so such documents land on the review list more often, especially early in the deployment.

Will the AI Worker post an invoice by itself if everything matches?

No. It prepares the description and marks the invoice as ready, and a person in the finance team posts it. For matching invoices approval is quick, because the documents and the check result are in one place. Changing this rule is the company's decision, not a default setting.

How many invoices do you need for this to pay off?

It depends on how long one invoice takes today and how many discrepancies there are. With a few dozen invoices a month, a well-organized document workflow is usually enough. With several hundred invoices tied to orders and receipts, the numbers look different, and How to calculate whether an AI Worker pays off helps you run them.

What it looks like in a project

Start with one task. Describe it, and DYNAMINDS Labs will prepare a free diagnosis.

Meet DYNAMINDS Labs

Read more: AI Workers

All in AI Workers →