KSeF

Received invoices in KSeF: how buyers find and download purchase invoices

When a purchase invoice becomes available to the buyer in KSeF, which KSeF API endpoints list and download it, the InvoiceRead permission, and what Notaly does not cover.

Published 3 min readBy Tomek

Overview

A purchase invoice becomes available to the buyer in KSeF once KSeF has accepted it and assigned a KSeF number: the buyer identified by the NIP in Podmiot2 can then find it and download it. Software does this through the KSeF API with a token that has the permission to read invoices (InvoiceRead). Notaly does not download purchase invoices today; it only issues them.

When does a purchase invoice show up in KSeF?

An invoice is available to the buyer only after KSeF accepts it and gives it a KSeF number. Until then there is nothing to download: an invoice rejected by KSeF never becomes available, and an invoice issued in offline mode appears only after the seller has sent it to KSeF and KSeF has accepted it. The buyer is matched by the NIP in Podmiot2, so an invoice with a wrong buyer NIP will not appear in your context.

Which KSeF API endpoints do you use?

The official KSeF documentation (CIRFMF/ksef-docs, section pobieranie-faktur) describes three ways to read invoices:

  • POST /v2/invoices/query/metadata — a paginated search over invoice metadata, filtered by subject type (for example, invoices where you are the buyer) and a date range. Use it to see what has arrived.
  • GET /v2/invoices/ksef/{ksefNumber} — downloads a single invoice XML by its KSeF number.
  • POST /v2/invoices/exports, then GET /v2/invoices/exports/{referenceNumber} — an asynchronous export of many invoices as an encrypted package, which you poll until it is ready.

Exports have hourly limits, so a sync job should export in contiguous date windows and deduplicate by KSeF number rather than export everything again. If GET /v2/invoices/ksef/{ksefNumber} answers 21165, the invoice has been processed but is not yet available for download; try again later.

What permission does the buyer need?

The token or certificate used to authenticate must carry the permission to read invoices, InvoiceRead, in the buyer's context. A token that can only issue invoices (InvoiceWrite) is not enough to read purchase invoices.

When is the invoice received for tax purposes?

When exactly an invoice counts as received for tax purposes is set by the VAT Act; confirm the dates that matter for your deductions with your accountant. The technical moment the invoice appears in the API is not, on its own, a tax decision.

Does Notaly download purchase invoices?

No. Notaly issues invoices: it has no endpoint that lists or downloads invoices you receive (there is no such route in its source code). The InvoiceRead permission in Notaly's token guide is there so Notaly can read the status and the UPO of the invoices you issue, not to fetch your purchase invoices. For received invoices, use the KSeF API directly, the Ministry's taxpayer application, or your accounting system.

In short

  • Available to the Podmiot2 NIP after acceptance and a KSeF number.
  • List with query/metadata, download with ksef/{ksefNumber}, bulk with exports.
  • Needs InvoiceRead; exports have hourly limits.
  • Tax receipt dates: confirm with your accountant. Notaly does not fetch purchase invoices.

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: github.com

Frequently asked questions

When can the buyer see a purchase invoice in KSeF?

Once KSeF has accepted it and assigned a KSeF number. It is then available to the buyer identified by the NIP in Podmiot2. An offline invoice appears only after it has been sent to KSeF and accepted.

Which permission does the buyer need?

A token or certificate with the permission to read invoices (InvoiceRead) in the buyer's context.

Does Notaly download purchase invoices?

No. Notaly only issues invoices; it has no endpoint for invoices you receive.

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.