CK Chris Kubicki

Polish e-invoicing · 2026

KSeF-app

Downloads, archives and browses invoices from Poland's national e-invoicing system — and matches bank transfers against them.

1. What it is

KSeF is where Polish businesses are moving their invoicing. KSeF-app is a client for it: pull down the invoices you issued and received, keep a local archive you control, browse and search them, and issue new ones.

Three front ends share one core — a command line tool, a REST service with a web interface, and a mobile app that syncs in the background.

2. The hard parts

  • Getting in at all KSeF does not accept a password. Authentication is a chain: request a challenge, encrypt it, submit it, poll for the outcome every two seconds until a token is issued, then redeem and refresh that token. Two separate certificates are involved.
  • Cryptography you cannot skip Key exchange uses RSA-OAEP with SHA-256; payloads use AES-256-CBC with PKCS#7 padding; and the key identifier is the base64 of the SHA-256 of the certificate's DER form. Every step has to be exactly right or the request is simply rejected.
  • Twenty thousand invoices, ninety days at a time Each query is capped to a 90-day window and truncated past 10,000 records or 1 GB. The syncer walks the windows and resumes from a high-water mark when a result was truncated — so a large archive converges instead of quietly losing a slice.
  • Exports that are portable but not readable An export is packaged as a ZIP with a random AES key, wrapped by the recipient's certificate, plus a metadata file. The archive can leave the machine without being readable in transit.
  • Staying inside the rate limits Every API group has its own budget. Push too hard and the system throttles you — and a sync that retries blindly only makes it worse, so requests are paced per group rather than globally.

3. Notes

  • Parses FA(3) invoice XML, and can issue invoices in offline mode when the connection is down.
  • Storage sits behind an interface built for PostgreSQL, so the filesystem backend can be replaced without touching the sync logic.

4. Contact

Something to build, fix or hook up? Write — replies usually land within a day, EU timezone.

chris@kubicki.live