# KSeF

KSeF ([Krajowy System e-Faktur](https://ksef.mf.gov.pl/)) is Poland's national e-invoicing platform. Think of it as a central government system where all structured invoices between Polish companies are sent, validated, and stored. Instead of exchanging invoices directly between buyer and seller, everything goes through KSeF - the Polish tax authority manages it, and every accepted invoice gets a unique KSeF number.

If You are sending invoices to Polish buyers, KSeF is the channel You need.

***

### KSeF or Peppol, which one do You need

KSeF is for **domestic Polish e-invoices**. If Your buyer is in Poland and receives invoices via KSeF, use this channel.

Peppol is an **international** e-invoicing network used across Europe and beyond. If Your buyer receives invoices via Peppol, check the dedicated [Peppol page instead.](/sales-invoices/creating-and-sending-invoices/peppol.md)

***

### How to get Your invoice into Fitek

Before an invoice can be sent to KSeF, it needs to exist in Fitek. There are four ways to do that.

#### Option 1: Create the invoice in Fitek

You can create a sales invoice manually in the Fitek user interface, then send it.&#x20;

#### Option 2: Send by email (Pdf2KSeF)

This is the "send a PDF, we digitize it, then we send it as an e-invoice" option.

**What You do:**

1. Send an email to Your dedicated outbound mailbox (for example `yourcompany@fitekdigi.com`).
2. Attach the PDF invoice to the email.

**What happens next:**

1. Fitek receives the email and applies mailbox rules (file size limits, allowed formats, notifications).
2. The PDF goes through OCR and data extraction.
3. The result is converted into structured invoice data and imported into Fitek as a sales invoice.
4. Once the invoice is in Fitek, You can send it to KSeF manually, or it is sent automatically if automatic sending is enabled.

#### Option 3: Import via SFTP

If You prefer file-drop integrations, these folders are supported:

* `/sales_input` : for structured XML (UBL or Estonian e-invoice format)
* `/sales_digi_input` : for PDF files that go through OCR and become structured data

#### Option 4: Import via API

If You create sales invoices in Your ERP and want to push them to Fitek, use the sales invoice import API.

**Endpoint:**

* Production: `https://fitekin.com/DataExchangeWebApiCore/SalesInvoice/ImportSalesInvoice.v3`
* Development: `https://dev.fitekin.com/DataExchangeWebApiCore/SalesInvoice/ImportSalesInvoice.v3`

**Method:** POST

**Header:** `Content-Type: application/xml`

**Body structure** (one sales invoice per request):

```xml
<SalesInvoiceImportRequest>
  <RequestId>00000000-0000-0000-0000-000000000000</RequestId>
  <IntegratorId>00000000-0000-0000-0000-000000000000</IntegratorId>
  <Payload>
    <Invoice>
      <E_Invoice>
        <!-- Sales invoice XML in Fitek e-invoice format -->
      </E_Invoice>
    </Invoice>
  </Payload>
</SalesInvoiceImportRequest>
```

***

### How sending works

#### Manual sending

When You click **Send e-invoice** in the Fitek user interface, Fitek:

1. Runs a pre-sending validation. This checks that each row has a description, quantity, unit, price, VAT type, and VAT %. It also checks that at least one invoice line is present and at least one VAT breakdown group is included.
2. Sends the invoice for delivery to KSeF.
3. Shows the status - either **Sent** or **Delivery issue**, with returned errors if something went wrong.

#### Automatic sending

If Your company setting **Send sales invoices automatically** is enabled, Fitek auto-sends invoices that are:

* Unsent
* Imported (not created manually in the user interface)

{% hint style="info" %}
Sales invoices with import issues or delivery issues are not sent automatically.
{% endhint %}

***

### Delivery status and troubleshooting <a href="#delivery-status-and-troubleshooting" id="delivery-status-and-troubleshooting"></a>

#### What You see in Fitek <a href="#what-you-see-in-fitek" id="what-you-see-in-fitek"></a>

When You send a sales invoice, Fitek shows one of these outcomes:

* **sent:** the invoice was accepted for delivery and no error message is shown
* **delivery issues:** the invoice could not be delivered, and an error message is shown (for example, the buyer was not found in Peppol, or there were validation issues with the invoice data)
* **import issues:** the invoice was imported, but some mandatory data is missing or invalid. Open the invoice, check the highlighted fields and error messages, fix the data, and then send again.
* **unsent:** the invoice is saved in Fitek but has not been sent yet. Open it, review the data, and send it when You are ready.

#### Where to check details <a href="#where-to-check-details" id="where-to-check-details"></a>

For each invoice, You can open the invoice details in Fitek to:

* see whether the invoice was sent
* review any delivery error message shown for that invoice
* confirm whether the invoice needs to be corrected and resent

***

### What happens when You send to KSeF

#### Statuses and KSeF number

* If KSeF **accepts** the invoice, You see a **Sent** status with a checkmark, and a KSeF number is shown on the invoice (you need to open the invoice)

<figure><img src="/files/OsZvlmG8515T5fhz5NxB" alt=""><figcaption></figcaption></figure>

* If KSeF **rejects** it, You see **Delivery issue** with error details explaining what went wrong.

#### Files returned after acceptance

Once the invoice status is **Sent**, Fitek retrieves and returns these files:

* **UPO:** the official acceptance confirmation (only for sales invoices)
* **PDF with KSeF QR code:** a printable version with the KSeF reference
* **FA(3) XML:** the invoice in the KSeF-native format
* **UBL:** the document that was originally sent, kept for traceability

***

### Technical details: the delivery API under the hood

If You need the exact delivery request format that Fitek uses to send to KSeF, here it is.

**Delivery endpoint (sales):** `{root_url}/fitekhub/connector/fitek/delivery/sales/v1`

**Request fields:**

* `referenceNr` (required)
* `invoiceGlobalId` (required)
* `xmlBase64`  base64-encoded XML payload (optional, but typically used)
* Optional `supplierParty` and `customerParty`

**Status callback endpoint:** `{root_url}/SalesInvoice/UpdateSalesInvoiceStatus.v1`

**Status callback fields:**

* `deliveryChannel`: KSEF
* `externalId`: the KSeF number
* `deliveryStatus`: PENDING, DELIVERED, or FAILED


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://fitek-learning.fitek.com/sales-invoices/creating-and-sending-invoices/ksef.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
