Skip to content

Translation. Original: limity/limity.md

Limits ​

21.10.2025

Introduction ​

The KSeF 2.0 system implements mechanisms that limit the number and size of API operations as well as parameters related to transmitted data. The purpose of these limits is to:

  • protect system stability at large scale operations,
  • counteract abuse and inefficient integrations,
  • prevent abuse and potential cybersecurity threats,
  • ensure equal access conditions for all users.

The limits have been designed with the possibility of flexible adaptation to the needs of specific entities requiring greater operation intensity.

API Request Limits ​

The KSeF system limits the number of requests that can be sent in a short time to ensure stable system operation and equal access for all users. More information can be found in API Request Limits.

Context Limits ​

ParameterDefault Value
Maximum invoice size without attachment1 MB
Maximum invoice size with attachment3 MB
Maximum number of invoices in interactive/batch session10,000

Authenticated Entity Limits ​

Requests and Active Certificates ​

Certificate IdentifierKSeF Certificate RequestsActive KSeF Certificates
NIP300100
PESEL126
Certificate fingerprint126

Limit Adjustment ​

The KSeF system enables individual adjustment of selected technical limits for:

  • API limits - e.g., increasing the number of requests for a selected endpoint,
  • context - e.g., increasing the maximum invoice size,
  • authenticating entity - e.g., increasing the limits of active KSeF certificates for an individual (PESEL).

On the production environment, limit increases are only possible based on a justified request, supported by real operational need. The request is submitted via the contact form, along with a detailed description of the use case.

Checking Individual Limits ​

The KSeF system provides endpoints allowing verification of current limit values for the current context or entity:

Getting Limits for Current Context ​

GET /limits/context

Returns the values of applicable limits for interactive and batch sessions for the current context.

C# example: KSeF.Client.Tests.Core/E2E/Limits/LimitsE2ETests.cs

csharp
Client.Core.Models.TestData.SessionLimitsInCurrentContextResponse limitsForContext =
    await LimitsClient.GetLimitsForCurrentContextAsync(
        accessToken,
        CancellationToken);

Java example:

ContextLimitIntegrationTest.java

java
GetContextLimitResponse response = ksefClient.getContextSessionLimit(accessToken);

Getting Limits for Current Entity ​

GET /limits/subject

Returns the applicable limits for certificates and certificate requests for the current authenticated entity.

C# example: KSeF.Client.Tests.Core/E2E/Limits/LimitsE2ETests.cs

csharp
Client.Core.Models.TestData.CertificatesLimitInCurrentSubjectResponse limitsForSubject =
        await LimitsClient.GetLimitsForCurrentSubjectAsync(
            accessToken,
            CancellationToken);

Java example:

SubjectLimitIntegrationTest.java

java
GetSubjectLimitResponse response = ksefClient.getSubjectCertificateLimit(accessToken);

Modifying Limits on Test Environment ​

On the test environment, a set of methods is available that enable changing and restoring limits to default values. These operations are only available for authenticated entities and do not affect the production environment.

Changing Session Limits for Current Context ​

POST /testdata/limits/context/session

C# example: KSeF.Client.Tests.Core/E2E/Limits/LimitsE2ETests.cs

csharp
Client.Core.Models.TestData.ChangeSessionLimitsInCurrentContextRequest newLimits =
    new()
    {
        OnlineSession = new Client.Core.Models.TestData.SessionLimits
        {
            MaxInvoices = newMaxInvoices,
            MaxInvoiceSizeInMB = newMaxInvoiceSizeInMB
            MaxInvoiceWithAttachmentSizeInMB = newMaxInvoiceWithAttachmentSizeInMB
        },

        BatchSession = new Client.Core.Models.TestData.SessionLimits
        {
            MaxInvoices = newBatchSessionMaxInvoices
            MaxInvoiceSizeInMB = newBatchSessionMaxInvoiceSizeInMB,
            MaxInvoiceWithAttachmentSizeInMB = newBatchSessionMaxInvoiceWithAttachmentSizeInMB,
        }
    };

await TestDataClient.ChangeSessionLimitsInCurrentContextAsync(
    newLimits,
    accessToken);

Java example:

ContextLimitIntegrationTest.java

java
ChangeContextLimitRequest request = new ChangeContextLimitRequest();
OnlineSessionLimit onlineSessionLimit = new OnlineSessionLimit();
onlineSessionLimit.setMaxInvoiceSizeInMB(4);
onlineSessionLimit.setMaxInvoiceWithAttachmentSizeInMB(5);
onlineSessionLimit.setMaxInvoices(6);

BatchSessionLimit batchSessionLimit = new BatchSessionLimit();
batchSessionLimit.setMaxInvoiceSizeInMB(4);
batchSessionLimit.setMaxInvoiceWithAttachmentSizeInMB(5);
batchSessionLimit.setMaxInvoices(6);

request.setOnlineSession(onlineSessionLimit);
request.setBatchSession(batchSessionLimit);

ksefClient.changeContextLimitTest(request, accessToken);

Restoring Session Limits for Context to Default Values ​

DELETE /testdata/limits/context/session

C# example: KSeF.Client.Tests.Core/E2E/Limits/LimitsE2ETests.cs

csharp
await TestDataClient.RestoreDefaultSessionLimitsInCurrentContextAsync(accessToken);

Java example: ContextLimitIntegrationTest.java

java
ksefClient.resetContextLimitTest(accessToken);

Changing Certificate Limits for Current Entity ​

POST /testdata/limits/subject/certificate

C# example: KSeF.Client.Tests.Core/E2E/Limits/LimitsE2ETests.cs

csharp
Client.Core.Models.TestData.ChangeCertificatesLimitInCurrentSubjectRequest newCertificateLimitsForSubject = new()
{
    SubjectIdentifierType = Client.Core.Models.TestData.TestDataSubjectIdentifierType.Nip,
    Certificate = new Client.Core.Models.TestData.TestDataCertificate
    {
        MaxCertificates = newMaxCertificatesValue
    },
    Enrollment = new Client.Core.Models.TestData.TestDataEnrollment
    {
        MaxEnrollments = newMaxEnrollmentsValue
    }
};

await TestDataClient.ChangeCertificatesLimitInCurrentSubjectAsync(
    newCertificateLimitsForSubject,
    accessToken);

Java example: SubjectLimitIntegrationTest.java

java
ChangeSubjectCertificateLimitRequest request = new ChangeSubjectCertificateLimitRequest();
request.setCertificate(new CertificateLimit(15));
request.setEnrollment(new EnrollmentLimit(15));
request.setSubjectIdentifierType(ChangeSubjectCertificateLimitRequest.SubjectType.NIP);

ksefClient.changeSubjectLimitTest(request, accessToken);

Restoring Certificate Limits for Entity to Default Values ​

DELETE /testdata/limits/subject/certificate

C# example: KSeF.Client.Tests.Core/E2E/Limits/LimitsE2ETests.cs

csharp
await TestDataClient.RestoreDefaultCertificatesLimitInCurrentSubjectAsync(accessToken);

Java example: SubjectLimitIntegrationTest.java

java
ksefClient.resetSubjectCertificateLimit(accessToken);

Related documents: