Authorization¶
This guide explains how to configure authorization for the KSeF integration. You will learn how to generate security tokens and manage authentication certificates within EspoCRM to ensure a secure connection with the National e-Invoice System.

How to Generate a KSeF Token¶
- Log in to the KSeF web application (environment links are provided below).
- Navigate to the Tokens section.
- Generate a new token and assign permissions to issue and read invoices.
- Securely save the generated token and paste it into your KSeF Profile within EspoCRM.
Example of a KSeF Token
20270115-EC-7FA3B1D200-AB12345F6A-01|nip-987654321|a1b2c3d4e5f60718293a4b5c6d7e8f90123456789abcdef0123456789abcdef0
How to Generate KSeF Certificates¶
You will need two certificates
Please note that the KSeF system requires two distinct types of certificates:
- Authentication: Used for verifying your identity when connecting to the system.
- Offline: Used solely to verify the authenticity of the issuer and the integrity of invoices in offline mode.
To generate a new certificate, log in to the appropriate environment:
- Production: https://ap.ksef.mf.gov.pl/web/
- Demo: https://ap-demo.ksef.mf.gov.pl/web/
- Test: https://ap-test.ksef.mf.gov.pl/web/
Navigate to the Certificates section and request a new certificate. Ensure you select the correct type (Authentication or Offline).
Once the package is ready, you will receive a notification in EspoCRM containing a direct link to the certificate package.
How to Add a KSeF Certificate to EspoCRM¶
- Navigate to the Administration section.
- Search for KSeF Settings and open it.
- Select the KSeF Profile you wish to update.
- Click the Edit button.
- Set the Authorization Type to
Certificate. - Link the appropriate certificate to the corresponding field. * Note: If you haven't uploaded the certificate to EspoCRM yet, click the arrow icon in the link field and select the option to create a New KSeF Certificate. * Upload your certificate and key files, and provide the password if applicable. * Click Save to link the certificate to the profile.
- Repeat the process for the second certificate type.
You can link a single certificate to multiple KSeF Profiles. Before proceeding, ensure the certificate status is set to Active.