Software Architecture Document Guide and Template for 2026
Abstract crystalline model with selectively tuned region
Fine-Tuning LLMs: When It Pays Off and How to Do It Right

Use KSeF API 2.0 with the FA(3) invoice structure, which has been mandatory since February 1, 2026. Build against the Ministry’s OpenAPI specification and official SDKs, test in the demo and test environments first, and authenticate with a method that fits your entity type. Plan for XAdES-BES signing, short-lived authentication challenges and production rate limits before go-live.


TL;DR:

  • Generate your client and CI contract tests from the Ministry’s OpenAPI specification, because API 1.0 is incompatible with version 2.0.
  • Match authentication to your legal form and permissions; enterprise integrations should favor KSeF certificates, implement XAdES-BES signing, and authenticate again when challenges expire.
  • Validate invoices against FA(3) before submission; Offline24 invoices must reach KSeF by the next business day, while emergency mode allows seven business days after resolution.
  • Use batch sessions for volume and retrieve failed invoices through the dedicated endpoint; request higher production limits early with peak load metrics.

Devpulse
Build a Reliable KSeF Integration
DevPulse builds custom software and cloud-based systems, helping businesses tackle complex integrations with solutions tailored to their goals.

Explore DevPulse

Which KSeF API environments and documents should you start with?

The integrator support page lists three environments, and each has a distinct job:

  • Production (api.ksef.mf.gov.pl): the production environment.
  • Integrative (test) (api-test.ksef.mf.gov.pl): testing against the v2 OpenAPI JSON.
  • Demo (api-demo.ksef.mf.gov.pl): a pre-production sandbox for rehearsing complete flows.

Use the OpenAPI JSON as the basis for your integration. Generate a client from it, then use the same file for contract tests in your CI pipeline, so a spec change fails a build instead of a production session. The test portal provides access to the test API documentation.

Watch the changelog closely. Changes to fields can affect parsing, archival and UPO handling. The Ministry’s publication of the API documentation also covers the SDKs and guidance for starting in test environments. Anything built for API 1.0 needs rework, because version 1.0 is not compatible with 2.0.

How do you authenticate with KSeF, and where do integrations break?

Authentication is the most common source of failed integrations, mainly because methods are segmented by legal form. Individuals can use Trusted Profile or a qualified signature. Entities use qualified seals, tokens in some contexts, or KSeF certificates, as the KSeF portal explains. Tokens are being phased out for general use, so for stable enterprise integrations we plan around KSeF certificates.

A practical sequence:

  1. Confirm which method your entity type allows and which context (NIP, PESEL or internal identifier) you act in.
  2. Verify that the right permissions are granted, using the MCU module for certificates and permissions, rolled out from November 1, 2025.
  3. Request KSeF certificates, which are available through the API and the taxpayer application and support offline issuance.
  4. Implement XAdES-BES signing for certificate-based authentication in commercial systems.
  5. Handle the challenge and response cycle with JWT access tokens, and re-authenticate gracefully when a challenge expires.

The authentication manual covers fingerprint retrieval and test-mode signing options.

Pro Tip: Check the authentication flow in the authentication manual and test your implementation in the available test environment.

Abstract authentication flow entering a test environment

What do FA(3) and the transmission modes mean for invoice dates?

Submitted XML must conform to FA(3), and per the KSeF 2.0 handbook invalid files are rejected, with a UPO assigned only after successful validation. Validate against the schema and required fields before you submit anything.

The mode you use changes the legal date logic:

The invoice modes table spells out QR code and P_1 requirements when an invoice is shared outside KSeF. Attachments use the FA(3) attachment node, but according to the official Q&A some advanced features, attachments included, need commercial integrated software rather than the free Ministry tools.

What does a practical ERP integration workflow look like?

A practical integration workflow can follow this order:

  1. Discovery: map your internal invoice model to FA(3), identify the contexts you act in and list the permissions each needs.
  2. Prototyping: generate a client from the OpenAPI spec or adopt the SDK, implement the challenge and response flow, and sign test requests where needed.
  3. Session flows: choose interactive sessions for single invoices and batch sessions for volume. Plan UPO handling, per-invoice status checks and failed-invoice retrieval from the start.
  4. Testing: use the demo and integrative environments to test your integration, including batch failures and invalid XML.
  5. Production: request higher limits if your volume needs them, switch credentials, and enable alerts for failed sessions and certificate expirations.

Batch sessions deserve extra care. A single failed invoice can complicate UPO retrieval, so use the failed-invoices endpoint to pull only the failures instead of relying on the session-level UPO. Our post on tenant-scoped B2B SSO covers session design patterns that carry over to this authentication flow.

How should you test, and how do you raise API limits?

Use the environments for what they are. The integrative environment works with anonymized data, while demo and production behave differently regarding persistence, so do not assume test results transfer one to one.

Limits are handled per the Ministry’s notice for integrators:

  • Default limits exist, and you can check the current values through the documented endpoints.
  • On test environments you can change limits and restore defaults programmatically.
  • In production, submit a justified request through the official contact form, with operational metrics and expected load.
  • Modified limits apply to demo and production once granted.

Design for the defaults anyway. Use batch sessions where appropriate and retrieve failed invoices selectively, as the KSeF guidance recommends.

Pro Tip: Send your limit request early and attach real peak numbers, such as invoices per hour at month end, because vague requests are easy to defer.

Should you use the official SDKs or a generated client?

The Ministry publishes open-source SDKs for Java and .NET, and the integrator page also offers example clients. A client generated from OpenAPI makes more sense for other languages or when your CI pipeline regenerates code on every spec change.

Check these response fields in either approach:

  • referenceNumber: ties your request to KSeF’s record.
  • invoiceFileName: needed for consistent archival naming.
    Check the API documentation for the response fields relevant to your integration.

When something fails, validate the schema first, then reproduce the error payload in the interactive documentation and compare it with the changelog. For documentation design, a good model is the Customerscore API reference, which shows how to structure developer onboarding.

Our perspective: where in-house KSeF work stops paying off

Most teams underestimate KSeF because the first successful test call feels like the finish line. The real work is everything after it: certificate lifecycle, XAdES-BES signing, batch failure recovery and monitoring that catches a lapsed certificate before month-end invoicing does. Our approach starts with discovery, maps legacy invoice formats to FA(3), then builds signing, batch handling and alerting as first-class parts of the system. Building in-house makes sense when invoice volume is modest and your team already owns the ERP. A partner earns its place when signing is new to you, volume is high or the invoicing stack is old. You can see comparable delivery work in our case studies.

— Vlad

How can we help with your KSeF integration?

Devpulse

If your ERP is complex, your volume is high or certificate handling is unfamiliar territory, we can take on the integration with you. Our team covers discovery, integration engineering, XAdES-BES signing, QA and production onboarding. For a first step, we suggest a technical audit through our technology consulting services. Contact us and we will review your invoicing landscape.

This article is general information, not a substitute for advice from a qualified financial advisor. Consult a qualified financial professional about your own circumstances before acting on anything here.

FAQ

What do I need before connecting to KSeF API 2.0?

You need FA(3)-compliant invoice output, an authentication method that fits your entity type, and access to the Ministry’s OpenAPI specification. Start in the test and demo environments before touching production, as described on the integrator support page.

Why does my KSeF authentication keep failing?

Authentication can fail if the method does not match your entity type or if required permissions are missing. Check the authentication manual and verify your setup. Check the authentication manual for guidance on authentication and test-mode differences.

How do I send many invoices without hitting rate limits?

Use batch sessions, paginate with the continuation token and retrieve only failed invoices instead of polling each one. If defaults still fall short, request higher limits through the form described in the Ministry’s notice.

Can I use the official SDKs for KSeF integration?

Yes. The Ministry maintains open-source SDKs for Java and .NET that take care of security and session handling. A client generated from OpenAPI is the alternative for other languages.

Sources

Keep the official pages open during implementation and monitor the API changelog for spec updates.

✕

Clarity starts with the right conversation

    By clicking "Send A Message", You agree to devPulse's Terms of Use and Cookie Policy. 

    Get In Touch

    "

    We partner with ambitious teams to solve complex challenges and create meaningful impact. From early ideas to full-scale delivery — we’re here to support every step. Tell us what you’re working on, and we’ll help you define the best way forward.

    Anna Tukhtarova

    CTO & Co-Founder

    ✕

    Vlad Tukhtarov

    CEO & Co-founder

    Vlad Tukhtarov is a technology executive and entrepreneur with over 15 years of experience building complex digital products and leading engineering teams. He began his career as a macOS (OS X) developer, working deeply with system-level applications and gaining a strong foundation in performance, architecture, and user-focused engineering. This hands-on technical background continues to influence how Vlad approaches leadership today — combining deep engineering understanding with business and product thinking. 

    As CEO & Co-Founder at devPulse, Vlad focuses on helping companies turn ideas into scalable digital products. He works closely with clients to define product direction, align business goals with technology, and ensure that solutions are designed not just to function — but to grow. 

    Want to turn your idea into a scalable product?

    Work directly with an experienced technology leader to define the right path forward.

    ✕

    Anna Tukhtarov

    CEO & Co-founder

    Anna Tukhtarova is a Chief Technology Officer and system architect with over 15 years of experience designing and delivering complex, high-performance software systems. She began her career as a C++ developer, working on performance-critical and system-level applications where efficiency, reliability, and precision were essential. 

    Over time, Anna transitioned into Technical Lead and System Architect roles, where she focused on designing scalable architectures, solving complex technical challenges, and ensuring that systems could evolve reliably under real-world conditions. As CTO & Co-Founder at devPulse, Anna drives technological innovation, aligns engineering practices across teams, and ensures consistent delivery of scalable, high-quality, and cost-effective solutions. 

    Need a technical audit or solid architecture?  Work directly with an experienced system architect.

    ✕