iFirma logo iFirma automation · runs daily

Issue an iFirma invoice and send it to KSeF

A client confirms the job, and the invoice is still a form: pick the contractor, add lines, issue it, then send it to KSeF and to the buyer as separate steps.

Cotlet does it in your own iFirma account with list_contractors, issue_invoice, send_invoice_to_ksef and send_invoice_email, called by your AI agent, an n8n workflow or a script.

Hosted · nothing to install or maintain

Can iFirma do this on its own?

iFirma has a documented API that issues a domestic invoice with POST fakturakraj.json, sends it by email and sends it to KSeF (checked 14 Oct 2026). It has no official MCP server. The gap is the setup: you activate API access, generate the invoice key, sign each request and write the code that finds the contractor and checks the totals.

How you do it in iFirma today

  1. Go to "Sprzedaż ➡ Faktury" and open the invoice form; pick the contractor, add lines with quantity, unit, price and VAT rate, and set the payment date.
  2. Click "Wystaw" to save and issue the invoice, or "Zapisz szkic" to keep a draft without a number that you can edit later.
  3. Open the issued invoice from "Sprzedaż ➡ Faktury ➡ lista faktur" and click "Wyślij do KSeF" at the bottom of the form.
  4. The status changes to "Przekazana do wysyłki" and then "Zaakceptowany" next to the invoice number, together with the KSeF number.
  5. What repeats: the contractor, lines and dates are entered again for every invoice, and the KSeF step is easy to forget.

How to issue an iFirma invoice and send it to KSeF

Prompt

Issue a domestic VAT invoice in iFirma for Blue Fern Studio: 2 x Website retainer, net 500.00 each, 23% VAT, due in 14 days. Find the contractor by NIP first. Show me the invoice before you issue it, then send it to KSeF and by email.
  1. 01

    Find the contractor first

    list_contractors searches by NIP, then by name, because iFirma keeps one record per buyer. A near match with a different spelling is shown to you instead of creating a duplicate.

  2. 02

    Check the totals before issuing

    The agent states contractor, lines, net, VAT, gross and due date from your prompt. A line with no VAT rate or unit is reported back, not guessed.

  3. 03

    Issue the invoice

    issue_invoice takes the next number in the default series. By default it waits for your OK, because an issued invoice cannot be changed freely once it reaches KSeF.

  4. 04

    Send to KSeF, then read the status

    send_invoice_to_ksef sends the invoice you just issued. The agent then reads it with get_invoice and reports "Zaakceptowany" with the KSeF number, or the rejection.

  5. 05

    Email the buyer last

    send_invoice_email goes out after the KSeF step, so the buyer receives an invoice that already has its KSeF number. It also waits for your OK.

What you get back

Example data

Issued invoice 41/2026 for Blue Fern Studio
2 x Website retainer: net 1,000.00, VAT 230.00, gross 1,230.00 PLN
Due 2026-10-28
KSeF: sent, status Przekazana do wysyłki
Emailed to billing@bluefern.example

Other ways to ask

  • Issue the same invoice for every client on my retainer list on the first of the month and show me the totals first.
  • Save a draft invoice for Blue Fern Studio from this quote, do not issue or send it.
  • Issue the invoice but do not send it to KSeF; I will send it myself after the review.

What iFirma allows, and what to know first

  • iFirma saves a draft with "Zapisz szkic" without a number, and drafts show in the invoice list and can be edited later.
  • Once an invoice is sent to KSeF, iFirma does not allow editing or deleting it.
  • The issue date cannot be later than the sending date, otherwise the Ministry of Finance rejects the invoice.
  • Only invoices issued through the invoice form can be sent to KSeF, and IOSS sales are not sent.
  • The same seller NIP, invoice number and document type already in KSeF is rejected as a duplicate, and so is a wrong buyer NIP.

issue_invoice, send_invoice_to_ksef and send_invoice_email ask for your OK by default. To run it daily without you, switch confirmation off for those tools in your dashboard.

Sources: iFirma Help: Wysyłka faktur do KSeF w IFIRMA · iFirma Help: Automatyczna wysyłka faktur do KSeF · iFirma API: faktura krajowa · iFirma API: wysyłanie faktury do KSeF

Call issue_invoice from a script

curl

curl -X POST https://cotlet.dev/api/v1/ifirma/contractors/c_4817/invoices \
  -H "Authorization: Bearer $COTLET_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"calculate_from":"net","issue_date":"2026-10-14","sale_date":"2026-10-14","due_date":"2026-10-28","payment_method":"transfer","lines":[{"name":"Website retainer","quantity":2,"unit":"month","unit_price":500,"vat_rate":23}]}'

Example response

{
  "id": 7020118,
  "number": "41/2026",
  "draft": false,
  "buyer": "Blue Fern Studio",
  "net": 1000,
  "vat": 230,
  "gross": 1230,
  "currency": "PLN",
  "issue_date": "2026-10-14",
  "due_date": "2026-10-28",
  "ksef_status": null
}

MCP: add https://cotlet.dev/mcp/v1 with the same key; the call is ifirma_write → issue_invoice. Example data.

Schedule it in n8n, Make, Zapier or cron

iFirma tools this automation uses

Cotlet iFirma tools used to issue an iFirma invoice and send it to KSeF
Tool Parameters
list_contractors name, nip, page
issue_invoice contractor_id, lines, calculate_from, issue_date, sale_date, due_date, payment_method, notes
send_invoice_to_ksef invoice_id
send_invoice_email invoice_id, recipient_email, message, include_transfer_details
All 14 iFirma tools with descriptions

Frequently asked questions

Can my agent turn on automatic KSeF sending?

It does not need to. In the app, "KSeF ➡ Konfiguracja KSeF" sets automatic or on-request sending, and the default is manual. With manual sending, send_invoice_to_ksef sends one invoice after your OK.

Is it safe to connect iFirma to Cotlet?

Yes. You sign in to iFirma yourself, in your own Cloud Browser in the EU, and we never save your password. Your agents only get iFirma once you enable it, every background request is listed, and the browser profile is stored encrypted with AES-256-GCM, the cipher 1Password uses for its vaults. The AI model never sees a login, posts and messages wait for your OK, and Disable for agents cuts access in one click. Independent scanners grade cotlet.dev A+ on Qualys SSL Labs, securityheaders.com and Mozilla Observatory; live results are on https://cotlet.dev/security.

Give your agent access to iFirma.

Free 7-day trial with 2,000 credits, no card needed. Cotlet is independent and not affiliated with iFirma.