KSeF

KSeF token: what it is and how to generate one

What the KSeF token is, how it authenticates your integration, how to generate it and where it fits in a Notaly setup.

Published 2 min readBy Tomek

Overview

A KSeF token is the credential your system uses to authenticate to Poland's KSeF API and open an online session. You generate it in the KSeF portal (or via the API), provide it to your integration — or to Notaly in Connect KSeF — and it lets you submit invoices without a qualified seal. The token authenticates the session; it is not used to sign the invoice.

What the token is for

KSeF (Krajowy System e-Faktur) is the national e-invoicing platform run by the Ministry of Finance (Ministerstwo Finansów). Before you can send a FA(3) invoice, your system must authenticate and open an online session. There are two ways to do that: sign the authentication challenge with XAdES using a qualified signature or seal (or a KSeF certificate), or authenticate with a KSeF-issued token.

In the token flow, the token is encrypted with the Ministry of Finance public key together with the challenge timestamp. That opens the session, and the invoice XML is then encrypted (AES-256, with the key wrapped by the Ministry's public key) and sent. The token is therefore an authentication credential, not a signing key — the invoice itself is not signed.

How to generate it

The token is issued through the KSeF portal or the KSeF API, following the Ministry of Finance's current instructions. Treat it like any other credential: store it outside your repository, rotate it if it is exposed, and keep track of its expiry so a request does not fail silently at the worst moment.

Where it fits in Notaly

In Notaly you paste the token once in Connect KSeF, in Settings. From then on Notaly authenticates each submission for you, sends the invoice to KSeF and returns the status and UPO through a webhook. You do not manage challenge timestamps, session renewal or expiry yourself.

If you are still evaluating, do not generate a production token yet — use the KSeF TEST environment first, where a test token lets you send test invoices without touching production data.

Disclaimer

Notaly is not a tax, accounting or legal advisor. This article is general information, not tax advice, and may be outdated. You are responsible for your own VAT compliance; confirm with a qualified accountant where required.

Sources

Source: www.podatki.gov.pl

Frequently asked questions

Is the KSeF token a signing key?

No. It is an authentication credential. The token is encrypted with the Ministry of Finance public key together with the challenge timestamp to open a session; the invoice XML is encrypted and sent, not signed with the token.

Do I need a qualified seal to use KSeF?

Not with Notaly. The token you provide in Connect KSeF authenticates the session without a qualified seal. XAdES with a qualified signature or seal (or a KSeF certificate) is the alternative authentication method.

Where do I generate the token?

In the KSeF portal or via the KSeF API, following the Ministry of Finance's instructions. Store it securely and treat it like a credential.

Issue your first KSeF test invoice today

Create a sandbox account: API key in seconds, 3 free test invoices on KSeF TEST, no credit card.