What each status means
- 415
- “Uwierzytelnianie zakończone niepowodzeniem” (authentication failed), details “Brak przypisanych uprawnień” (no permissions assigned): the person or entity on the certificate holds no permissions in the context of that NIP.
- 425
- “Uwierzytelnienie unieważnione” (authentication revoked), details “Uwierzytelnienie i powiązane refresh tokeny zostały unieważnione przez użytkownika”: someone closed that sign-in session.
- 450
- “Uwierzytelnianie zakończone niepowodzeniem z powodu błędnego tokenu” (failed because of a bad token), with details such as “Token unieważniony”, “Token nieaktywny”, “Nieprawidłowy czas tokena” or “Token nie może być użyty w kontekście {contextIdentifier}”: it is about signing in with a KSeF token.
- 470
- “Uwierzytelnianie zakończone niepowodzeniem”, details “Próba wykorzystania metod autoryzacyjnych osoby zmarłej” (attempt to use the credentials of a deceased person).
- 480
- “Uwierzytelnienie zablokowane” (authentication blocked), details “Podejrzenie incydentu bezpieczeństwa. Skontaktuj się z Ministerstwem Finansów przez formularz zgłoszeniowy.” (suspected security incident; contact the Ministry through its form).
- 500 and 550
- “Nieznany błąd” (unknown error) and “Operacja została anulowana przez system” (cancelled by the system), with details “Przetwarzanie zostało przerwane z przyczyn wewnętrznych systemu. Spróbuj ponownie” (processing stopped for internal reasons; try again).

KSeF tokens and Odoo
Odoo 18, 19 and 20 have a function to sign in with a KSeF token in their code, but nothing calls it: they only sign in with the certificate. So a 450 at sign-in does not come from Odoo. If you see one, it comes from another program that uses a token, such as an accounting office's. KSeF tokens are revoked automatically when their owner loses permissions.
For the other statuses Odoo shows “KSeF Authentication failed with status …: …” with the description and without the details. For 415 and 470 the description is the same, so only the details field tells them apart.
Access tokens, refresh, and codes 21301 and 21304
| Item | KSeF | Odoo 18, 19 and 20 |
|---|---|---|
| accessToken | Valid for a dozen or so minutes, as set in its exp field | After an HTTP 401 it refreshes it and repeats the request once. |
| refreshToken | Up to 7 days | The scheduled action “Refresh KSeF tokens” signs in again with the certificate every 6 days. |
| 21301 “Brak autoryzacji.” (no authorisation) | When redeeming or refreshing tokens, for example “Token KSeF został unieważniony.” (KSeF token revoked) | You see “Failed to refresh KSeF access token. You may need to re-authenticate manually. Error: 400 Client Error…”, without the code. |
| 21304 “Brak uwierzytelnienia.” (no authentication) | “Operacja uwierzytelniania o numerze referencyjnym {referenceNumber} nie została znaleziona.” | Same: the code does not reach the screen. |

What to do
- 415, or 21301 after permissions were removed: the company owner grants permissions in KSeF to the person on the certificate, and you save the certificate in Odoo's settings again.
- 425: someone revoked the sign-in session; save the certificate again so Odoo signs in afresh.
- 480: do what KSeF says and contact the Ministry of Finance through its form; retrying the sign-in will not help.
- 500 or 550: try again.
Our module, Poland KSeF 2.0 Validator, keeps a list of KSeF certificates and tokens with their expiry dates, but it does not sign in to KSeF and does not see these statuses.
Keep reading
Checked in the module's source code (version 20.0) and the linked sources
Sources
- github.com/CIRFMF/ksef-api/blob/ce3670ea042de380039de4c5849fd6455811b292/open-api.json
- github.com/CIRFMF/ksef-api/blob/ce3670ea042de380039de4c5849fd6455811b292/uwierzytelnianie.
- github.com/CIRFMF/ksef-api/blob/ce3670ea042de380039de4c5849fd6455811b292/uwierzytelnianie.
- github.com/odoo/odoo/blob/2982b5f44af03fae6a9888f20632c1cc19f623ba/addons/l10n_pl_edi/tool
- github.com/odoo/odoo/blob/2fec20391a8a61ea3a3bf15e9f24d59dba910a8d/addons/l10n_pl_edi/tool
- github.com/odoo/odoo/blob/2982b5f44af03fae6a9888f20632c1cc19f623ba/addons/l10n_pl_edi/i18n
- github.com/odoo/odoo/blob/2982b5f44af03fae6a9888f20632c1cc19f623ba/addons/l10n_pl_edi/tool
- github.com/odoo/odoo/blob/4d2d4b5895db70596863df941d9a1f0beeb117f8/addons/l10n_pl_edi/tool
- github.com/odoo/odoo/blob/2fec20391a8a61ea3a3bf15e9f24d59dba910a8d/addons/l10n_pl_edi/tool
- github.com/odoo/odoo/blob/2fec20391a8a61ea3a3bf15e9f24d59dba910a8d/addons/l10n_pl_edi/tool
- github.com/odoo/odoo/blob/2fec20391a8a61ea3a3bf15e9f24d59dba910a8d/addons/l10n_pl_edi/tool
- github.com/odoo/odoo/blob/2fec20391a8a61ea3a3bf15e9f24d59dba910a8d/addons/l10n_pl_edi/mode
- github.com/odoo/odoo/blob/2fec20391a8a61ea3a3bf15e9f24d59dba910a8d/addons/l10n_pl_edi/data
- github.com/odoo/odoo/blob/2fec20391a8a61ea3a3bf15e9f24d59dba910a8d/addons/l10n_pl_edi/tool
- github.com/psf/requests/blob/v2.32.5/src/requests/models.py#L730
- Module source code: flexigo_poland_ksef_2_0_e_invoice_connector_and_migrati 20.0 (ba7c60f1): models/ksef_credential.py
