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 Subiekt nexo and Subiekt GT cost in 2026: licence prices, the Abonament, and the 30 days that raise the renewal by half
Blog

What Subiekt nexo and Subiekt GT cost in 2026: licence prices, the Abonament, and the 30 days that raise the renewal by half

Subiekt nexo for 3 workstations is 1 275 zł net, Subiekt GT 1 045 zł, nexo PRO 2 575 zł. Those are perpetual licences, and then there's the yearly Abonament: 349 zł for nexo if you renew within 30 days of expiry, 539 zł if later. Plus Sfera (the API), the accounting-office client licences, and a comparison with Optima and enova365.

Read more→
What Comarch ERP Optima costs in 2026: the subscription list, Basic vs Pro, and three costs it leaves out
Blog

What Comarch ERP Optima costs in 2026: the subscription list, Basic vs Pro, and three costs it leaves out

Optima's price list is public: Podstawowy 59 zł a month, Logistyka Basic 75 zł, Księga Handlowa 175 zł. The catch is the word Pro: it's a top-up on Basic, not a separate tier, so full accounting in Finanse costs 250 zł, not 200. Plus the Podstawowy limits, how HR counts employees for accounting offices, and two worked examples.

Read more→
December pay paid in January 2027: a 2026 or a 2027 cost? The 8 January payday and ZUS by 15 or 22 February
Blog

December pay paid in January 2027: a 2026 or a 2027 cost? The 8 January payday and ZUS by 15 or 22 February

December payroll paid in January is a 2026 cost, but only if the pay leaves on the date in the client's pay rules and the ZUS contributions reach ZUS on time. 10 January 2027 is a Sunday, so the statutory deadline ends on Friday 8 January. The same pay lands in the employee's 2027 PIT-11. Here's what an office checks in December and in February.

Read more→