KSeF

How to check KSeF invoice status and retrieve the UPO

How to check an invoice's KSeF status and retrieve the UPO: the submit response, polling GET /invoices/{id} and the signed status webhooks.

Published 4 min readBy Tomek

Overview

When you create an invoice, the POST /invoices response usually returns submitted with a KSeF reference number (if it returns draft with ksef_submitting, Notaly resends it itself — do not create a new invoice), and the final decision — accepted or rejected — arrives later. You can verify it by polling GET /invoices/{id}, which re-checks KSeF while the invoice is still submitted, or by listening for the signed status webhook. With the accepted status you get the KSeF number; Notaly then requests the UPO, which is available when KSeF issues it.

The statuses

An invoice moves through a small set of states. draft means the FA(3) XML was generated but KSeF has not confirmed the submission: the error field is ksef_submitting while Notaly resends the same XML, or ksef_retry_exhausted once it stops. Older drafts may show error: null or ksef_unavailable; Notaly does not resend those, so write to hello@getnotaly.com with the invoice id instead of creating a new invoice. submitted means it reached KSeF and is being processed. accepted means KSeF accepted it and the KSeF number is set; the upo field is filled when KSeF issues the UPO. rejected means KSeF refused it and the error field holds a stable code such as ksef_rejected:<code>.

An invoice that fails the FA(3) schema check is not stored at all: POST /invoices answers 422 before anything is sent to KSeF.

If KSeF has not confirmed the submission

If the response is draft with error: "ksef_submitting", KSeF has not confirmed the submission yet. Do not send a new POST and do not issue the invoice again under a new number: Notaly resends the same XML automatically. Poll GET /invoices/{id} until the status is submitted. If the status is submitted with error: "ksef_duplicate_review", KSeF already has this invoice from an earlier attempt. Do not reissue it with another number; we link it to the KSeF record on our side. If you need it sooner, write to hello@getnotaly.com with the invoice id. If the invoice is draft with error: "ksef_retry_exhausted", Notaly has stopped resending it automatically (after 24 hours, or earlier if KSeF returned a definitive error). Do not create a new invoice: write to hello@getnotaly.com with the invoice id, and we check in KSeF whether it arrived before anything is resent. If an invoice is still draft with error: null or ksef_unavailable after about a minute, Notaly does not resend it: do not create a new invoice; write to hello@getnotaly.com with the invoice id.

Verify by polling

GET /invoices/{id} returns the same invoice object you got on creation. While the invoice is submitted, this call also checks KSeF and records the decision, so polling it is a valid alternative to webhooks if you do not want to run a webhook endpoint. Poll at a sensible interval — KSeF decides asynchronously, so a single immediate check will often still show submitted.

Verify by webhook

If you register an HTTPS endpoint, Notaly pushes the result to you. invoice.accepted carries the KSeF number, the UPO if KSeF has already issued it (otherwise null) and an absolute pdfUrl, which needs your API key to download; invoice.rejected carries the error code. invoice.error is sent only when an invoice is in an inconsistent state that needs support. If KSeF does not confirm the submission inside POST /invoices, you see draft with ksef_submitting in the POST response; once the resend is accepted or rejected, the usual webhook follows. ksef_duplicate_review and ksef_retry_exhausted get no webhook. Every delivery is signed with HMAC and retried with backoff, and deliveries are at-least-once, so deduplicate on X-Webhook-Id.

In the dashboard

The Notaly dashboard shows your invoice list with each invoice's status, and lets you open the XML, the PDF and, once KSeF has issued it, the UPO. That is the fastest way to check a single document by hand.

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

How do I know the final result after submitting?

Poll GET /invoices/{id} (it re-checks KSeF while submitted) or listen for the signed invoice.accepted / invoice.rejected webhook.

When do I get the UPO?

When KSeF issues it. Notaly requests the UPO as soon as the invoice is accepted. If it is not available yet, Notaly retries in the background and the UPO then appears in GET /invoices/{id} and in the dashboard.

What if KSeF is unavailable when I submit?

Notaly keeps the invoice as draft with error ksef_submitting and resends the same XML automatically. Do not send a new POST; poll GET /invoices/{id}. If it ends as ksef_retry_exhausted, write to hello@getnotaly.com with the invoice id.

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.