Blog— Anton Ignashev

Auto-Pulling Purchase Invoices From KSeF — Turning the Inbox Into Ready-to-Book Entries

Auto-Pulling Purchase Invoices From KSeF — Turning the Inbox Into Ready-to-Book Entries

For years the hardest part of booking a purchase invoice wasn't the accounting — it was getting the invoice into a usable shape. Someone had to find the PDF in an inbox, read the numbers off it, retype them, and hope the OCR guessed the VAT rate right. KSeF quietly deleted that entire problem for Polish purchase invoices, and almost nobody has rebuilt their process around the fact.

Structured e-invoicing became mandatory in phases through 2026 — receipt for all taxpayers from February, issuing for everyone from April, with penalties suspended through the end of the year. (For the regulatory fine print, podatki.gov.pl is the source; this is an implementation article, not legal advice.) The conversation so far has been all about compliance: how do we get ready? That question is answered. The interesting one is the next one: now that every invoice you receive lands in one national system as clean, structured data, why is anyone still typing them into the books by hand?

What "pull from KSeF" actually means

It means fetching invoices as data, not as pictures. When a supplier issues you a cost invoice, it doesn't just email you a PDF — it registers a structured FA(3) document in KSeF, and that document is available to you through the KSeF API 2.0. NIP, amounts, net/gross, per-position VAT rates, the KSeF reference number: all of it arrives as fields, already machine-readable.

That single fact changes the economics of bookkeeping. The classic automation pitch was "our OCR reads your invoices 95% accurately." With KSeF there is nothing to read — the data is exact because the supplier's own system produced it. This is why I describe the whole approach as post-KSeF automation, not OCR. OCR was a workaround for the era when invoices were images. That era is ending for domestic B2B.

The agent loop, step by step

An AI agent for accounting turns that raw availability into finished work. Here's the loop it runs, unattended, on a schedule:

  1. Poll KSeF for new inbound purchase invoices since the last run. Each comes back as an FA(3) structured document.
  2. Normalise the data — seller, dates, amounts, VAT breakdown, line items — into your chart-of-accounts vocabulary.
  3. Verify the counterparty (the step humans skip when busy — more below).
  4. Classify the booking — which cost account, KUP vs NKUP, VAT deductible or not, cost centre — using a mix of rules and a language model that learns your firm's conventions.
  5. Write a draft, not a final entry, into your accounting system, with every field pre-filled and a note explaining any judgment call.
  6. Queue it for one-click approval. A human sees a ready booking and either confirms it or nudges it.

The accountant stops being a typist and becomes a reviewer. The volume that used to eat a morning — thirty, fifty, a hundred invoices — arrives already sorted, and the human spends their attention only on the handful that are genuinely ambiguous. If you've read how AI agents differ from a simple chatbot, this is the concrete version: an agent that does a multi-step job end to end, not a box that answers questions.

Why the counterparty check matters more than the typing

Here's the part most "invoice automation" tools ignore because it isn't glamorous: before you book a cost, you're supposed to know who you're paying. For any payment over 15 000 zł by transfer, Polish law expects you to confirm the supplier's active VAT status and that the invoice's bank account appears on the official whitelist (biała lista). Miss it and you can lose the deduction and pick up joint liability for the supplier's VAT. We packaged this exact check as a standalone Telegram bot that verifies contractors by NIP — handy when you just need a quick check outside the full pipeline.

A human under deadline pressure checks this... sometimes. An agent checks it every time. On each invoice it runs a verification pipeline against public registries:

  • Biała lista (the Ministry of Finance VAT whitelist) — active VAT status plus a match of the invoice's IBAN against the registered accounts, storing the query ID as proof of due diligence.
  • VIES for EU counterparties — validity of the VAT number for intra-community transactions.
  • NIP checksum and registry status as a first, free gate before anything else.

None of this is new obligation — it's existing obligation that was previously done inconsistently. Automating the pull from KSeF is what finally makes automating the check free, because the agent is already holding the invoice as data at exactly the moment the check needs to happen.

Where OCR still lives

Honesty check: KSeF doesn't cover everything. Paper receipts from a petrol station, invoices from a supplier in Germany, a pre-mandate PDF from a laggard — these never enter KSeF. The agent keeps an OCR path for exactly this tail, but treats it as the exception, not the design centre. The mistake is building your whole process around OCR when 80–90% of your domestic purchase invoices now arrive as perfect structured data through one API. Design for the KSeF path; fall back to OCR only when you must.

This is the same door KSeF already opened

If you run a wholesale or distribution business, you may recognise this argument in a different costume. I've written about how, right after a KSeF rollout, adding a B2B portal costs less because the ERP integration already exists. The accounting agent is the mirror image: KSeF opened your ERP's integration surface and created a single API where every purchase invoice appears. The portal reuses that opening to let clients order; the accounting agent reuses it to book what you buy. One rollout, two automations, same plumbing.

The end state is worth naming plainly: from the moment a supplier issues you an invoice to the moment a reviewed, verified booking sits in your accounting system, nobody retypes anything and nobody forgets the whitelist check.

Getting started without betting the farm

You don't switch this on across the whole company on day one. The sane path:

  • Start read-only: let the agent pull and draft for one cost category or one client of the accounting office, and compare its drafts against what a human would have booked for a week.
  • Keep every write as a draft with mandatory human approval — no silent posting, ever.
  • Widen the scope once the drafts are boringly correct.

Draft-only, human-in-the-loop, one category at a time. That's how you get the speed without inheriting a machine's mistakes.


I build these accounting agents for Polish accounting offices and finance teams — wired to KSeF and your existing system, draft-only, with the counterparty check built in. If you want to see what the invoice-to-books loop would look like on your setup, let's talk.

Check a Polish VAT counterparty in seconds, free

KsięgoAI checks a NIP against the VAT white list and VIES, scores the risk and saves proof of due diligence. Works in Telegram and Claude.

Try KsięgoAI→

Let’s talk about your project

Free 30-minute consultation. We’ll figure out if and how I can help.

Book a Free 30-Minute Call

Select a date

November 2026
Mon
Tue
Wed
Thu
Fri
Sat
Sun
← Back to Blog

Related Posts

What Symfonia costs in 2026: the price list for Finanse i Księgowość, the cloud, eBiuro and accounting-office bundles
Blog

What Symfonia costs in 2026: the price list for Finanse i Księgowość, the cloud, eBiuro and accounting-office bundles

Symfonia Finanse i Księgowość costs 1 620 to 3 550 zł net a year in 2026 and is sold only as a subscription. The cloud ERP is 490 zł per user per month, eBiuro for accounting offices starts at 409 zł a year, and the office bundles cost 1 890, 3 696 or 11 694 zł. The full list from symfonia.pl, KSeF Plus limits from 2027 and a three-year comparison.

Read more→
PIT-11, PIT-4R, PIT-8AR and IFT-1R for 2026: the 1 February and 1 March 2027 deadlines and the three totals that must agree
Blog

PIT-11, PIT-4R, PIT-8AR and IFT-1R for 2026: the 1 February and 1 March 2027 deadlines and the three totals that must agree

The payer's annual returns for 2026 go to the tax office by Monday 1 February 2027, because 31 January is a Sunday. PIT-11 to employees and IFT-1R follow by 1 March. Before anything goes out, three totals have to agree: PIT-11s against PIT-4R, PIT-4R against the bank statement, and flat-rate tax against PIT-8AR. Correct a PIT-11 after mid-February and it lands on an employee whose Twój e-PIT is already prefilled.

Read more→
KSeF API 2.0 error codes: 440, 450, 21405 and the rest — what they mean and how to fix them in enova365, Optima and Subiekt
Blog

KSeF API 2.0 error codes: 440, 450, 21405 and the rest — what they mean and how to fix them in enova365, Optima and Subiekt

KSeF reports errors on three levels: an HTTP exception with a 21xxx code, a session status and an invoice status. The same number means different things on each, so 440 is a duplicate invoice in one place and a cancelled session in another. The code table from the Ministry's own spec, the fix for each, and the one error you must never fix by renumbering the invoice.

Read more→