Build Poland JPK_V7M XML (SAF-T VAT)
Skill: Convert VAT records + return figures into a JPK_V7M XML
Region: Poland (Polska)
Category: JPK — Jednolity Plik Kontrolny (SAF-T)
Does: Takes a month's sales and purchase VAT records plus the computed VAT-return figures and emits a valid JPK_V7M XML — the combined VAT records + declaration file that VAT-registered taxpayers send monthly to the Ministerstwo Finansów (KAS) gateway.
Schema: JPK_VAT z deklaracją, kodSystemowy="JPK_V7M (2)", wersjaSchemy="1-0E" (monthly). The quarterly variant is JPK_V7K (records every month, declaration only in the last month of the quarter).
This is a conversion task: input = your VAT registers and return totals, output = JPK_V7M XML. The element names below are the mapping target. Field codes (
P_*,K_*), GTU groups, and procedure markers are revised periodically — always validate the emitted XML against the current official XSD from the Ministerstwo Finansów before sending.
When JPK_V7M is required
- Every taxpayer registered for VAT (czynny podatnik VAT) in Poland files JPK_V7M monthly (or JPK_V7K if on quarterly VAT). There is no longer a separate VAT-7 form — the declaration is embedded in this file.
- Deadline: by the 25th of the month following the reporting period.
CelZlozenia = 1for an original submission,2for a correction of the same period.
Input data required
| Group | Fields |
|---|---|
| Header | tax-office code, year, month, purpose (original/correction), system name, generation timestamp |
| Entity (Podmiot1) | NIP, full name, email (+ optional phone) |
| Declaration (Deklaracja) | the P_* return positions — output base/VAT, input VAT, amount payable or excess |
| Sales records (SprzedazWiersz) | per document: counterparty NIP + name, document number, issue/sale dates, doc type, GTU + procedure markers, net/VAT amounts by rate (K_*) |
| Sales control (SprzedazCtrl) | number of sales rows, total output VAT |
| Purchase records (ZakupWiersz) | per document: supplier NIP + name, document number, purchase/receipt dates, input net + VAT (K_*), markers |
| Purchase control (ZakupCtrl) | number of purchase rows, total input VAT |
Document structure
JPK
├─ Naglowek KodFormularza(JPK_VAT), WariantFormularza=2, DataWytworzeniaJPK,
│ NazwaSystemu, CelZlozenia, KodUrzedu, Rok, Miesiac
├─ Podmiot1 rola="Podatnik"
│ └─ OsobaNiefizyczna NIP, PelnaNazwa (or OsobaFizyczna for sole traders)
│ └─ (Email, Telefon)
├─ Deklaracja
│ ├─ Naglowek KodFormularzaDekl(VAT-7), WariantFormularzaDekl=22
│ ├─ PozycjeSzczegolowe P_10 … P_68 (only non-zero positions are emitted)
│ └─ Pouczenia = 1
└─ Ewidencja
├─ SprzedazWiersz[] one per output document
├─ SprzedazCtrl LiczbaWierszySprzedazy, PodatekNalezny
├─ ZakupWiersz[] one per input document
└─ ZakupCtrl LiczbaWierszyZakupow, PodatekNaliczony
Field rules and code tables
Header (Naglowek)
KodFormularza kodSystemowy="JPK_V7M (2)" wersjaSchemy="1-0E"with text valueJPK_VAT.WariantFormularza=2.CelZlozenia poz="P_7"=1(original) or2(correction).KodUrzedu— 4-character code of the competent tax office (Urząd Skarbowy).Rok/Miesiac— reporting year and month (month1–12).DataWytworzeniaJPK— full ISO timestamp, e.g.2026-06-05T10:00:00Z.
Entity (Podmiot1)
NIP— 10-digit tax identifier (digits only).PelnaNazwa— registered legal name. UseOsobaFizyczna(withImiePierwsze,Nazwisko,DataUrodzenia) for individuals.
Declaration positions (PozycjeSzczegolowe) — most-used
| Position | Meaning |
|---|---|
P_19 / P_20 |
net base / VAT due on 23% (22%) domestic sales |
P_17 / P_18 |
net base / VAT due on 8% (7%) sales |
P_15 / P_16 |
net base / VAT due on 5% sales |
P_13 |
net base of 0% sales |
P_37 |
total taxable base (sum of bases) |
P_38 |
total output VAT (podatek należny) |
P_42 / P_43 |
net / input VAT on fixed-asset purchases |
P_44 / P_45 |
net / input VAT on other purchases |
P_48 |
total input VAT (podatek naliczony) |
P_51 |
amount of VAT to pay (kwota do zapłaty) |
P_53 |
excess of input over output VAT |
P_54 |
amount to refund |
- Emit only positions with a non-zero value; omit empty ones. All money values are integer złoty in the declaration (rounded to whole PLN).
Sales row (SprzedazWiersz)
LpSprzedazy— sequential row number (starts at 1).NrKontrahenta— buyer NIP (orBRAKwhere none, e.g. retail).NazwaKontrahenta,DowodSprzedazy(document number),DataWystawienia,DataSprzedazy.TypDokumentu—RO(daily retail summary),WEW(internal),FP(invoice to a receipt); omit for ordinary invoices.- GTU markers —
GTU_01…GTU_13, value1when the line includes that goods/services group (e.g.GTU_03fuels-oils,GTU_12intangible services). - Procedure markers —
TP(related parties),WSTO_EE,MPP(split payment — for purchases),MR_T, etc., value1when applicable. - Amount fields
K_10…K_36carry net/VAT by rate and transaction kind; values are decimal PLN with 2 places (e.g.K_19net 23%,K_20VAT 23%).
Purchase row (ZakupWiersz)
LpZakupu,NrDostawcy(supplier NIP),NazwaDostawcy,DowodZakupu.DataZakupu(purchase date), optionalDataWplywu(receipt date).K_40/K_41net/VAT on fixed assets;K_42/K_43net/VAT on other purchases.- Markers:
MPP,IMP(import),MK(cash method) where applicable.
Control sums
SprzedazCtrl:LiczbaWierszySprzedazy(count of sales rows) andPodatekNalezny(sum of output VAT in the records) — must reconcile with the records.ZakupCtrl:LiczbaWierszyZakupowandPodatekNaliczony.
Calculation rules
- Records (
Ewidencja) hold per-document amounts with 2 decimals; declaration (Deklaracja) holds whole-złoty rounded figures. P_38(output VAT) generally equalsSprzedazCtrl/PodatekNaleznyrounded to whole PLN;P_48(input VAT) ties toZakupCtrl/PodatekNaliczony.- If
P_38 > P_48⇒P_51=P_38 − P_48(to pay). IfP_48 ≥ P_38⇒P_53=P_48 − P_38(excess), split intoP_54(refund) and/or carry-forward.
Worked example — one 23% sale, one 23% purchase (June 2026)
Records
- Sale: invoice
FV/2026/06/001to NIP5252445767, net 10 000.00, VAT 2 300.00 (23%). - Purchase: invoice
Z/77from NIP7010001234, net 4 000.00, input VAT 920.00. - Declaration: output VAT 2 300, input VAT 920 ⇒ to pay 1 380.
<?xml version="1.0" encoding="UTF-8"?>
<JPK xmlns="http://crd.gov.pl/wzor/2021/12/27/11148/"
xmlns:tns="http://crd.gov.pl/wzor/2021/12/27/11148/">
<Naglowek>
<KodFormularza kodSystemowy="JPK_V7M (2)" wersjaSchemy="1-0E">JPK_VAT</KodFormularza>
<WariantFormularza>2</WariantFormularza>
<DataWytworzeniaJPK>2026-07-05T09:00:00Z</DataWytworzeniaJPK>
<NazwaSystemu>ERP 1.0</NazwaSystemu>
<CelZlozenia poz="P_7">1</CelZlozenia>
<KodUrzedu>1471</KodUrzedu>
<Rok>2026</Rok>
<Miesiac>6</Miesiac>
</Naglowek>
<Podmiot1 rola="Podatnik">
<OsobaNiefizyczna>
<NIP>1234567890</NIP>
<PelnaNazwa>Przyklad Sp. z o.o.</PelnaNazwa>
</OsobaNiefizyczna>
</Podmiot1>
<Deklaracja>
<Naglowek>
<KodFormularzaDekl kodSystemowy="VAT-7 (22)" kodPodatku="VAT"
rodzajZobowiazania="Z" wersjaSchemy="1-0E">VAT-7</KodFormularzaDekl>
<WariantFormularzaDekl>22</WariantFormularzaDekl>
</Naglowek>
<PozycjeSzczegolowe>
<P_19>10000</P_19>
<P_20>2300</P_20>
<P_37>10000</P_37>
<P_38>2300</P_38>
<P_44>4000</P_44>
<P_45>920</P_45>
<P_48>920</P_48>
<P_51>1380</P_51>
</PozycjeSzczegolowe>
<Pouczenia>1</Pouczenia>
</Deklaracja>
<Ewidencja>
<SprzedazWiersz>
<LpSprzedazy>1</LpSprzedazy>
<NrKontrahenta>5252445767</NrKontrahenta>
<NazwaKontrahenta>Klient S.A.</NazwaKontrahenta>
<DowodSprzedazy>FV/2026/06/001</DowodSprzedazy>
<DataWystawienia>2026-06-10</DataWystawienia>
<DataSprzedazy>2026-06-10</DataSprzedazy>
<K_19>10000.00</K_19>
<K_20>2300.00</K_20>
</SprzedazWiersz>
<SprzedazCtrl>
<LiczbaWierszySprzedazy>1</LiczbaWierszySprzedazy>
<PodatekNalezny>2300.00</PodatekNalezny>
</SprzedazCtrl>
<ZakupWiersz>
<LpZakupu>1</LpZakupu>
<NrDostawcy>7010001234</NrDostawcy>
<NazwaDostawcy>Dostawca Sp. z o.o.</NazwaDostawcy>
<DowodZakupu>Z/77</DowodZakupu>
<DataZakupu>2026-06-15</DataZakupu>
<K_42>4000.00</K_42>
<K_43>920.00</K_43>
</ZakupWiersz>
<ZakupCtrl>
<LiczbaWierszyZakupow>1</LiczbaWierszyZakupow>
<PodatekNaliczony>920.00</PodatekNaliczony>
</ZakupCtrl>
</Ewidencja>
</JPK>
Validation checklist
-
KodFormularzaisJPK_VATwithkodSystemowy="JPK_V7M (2)"and the currentwersjaSchemy. -
KodUrzedu,Rok,Miesiac, andCelZlozenia(1 original / 2 correction) are set. -
NIPis 10 digits, digits only; entity name matches the registration. - Declaration
P_*values are whole złoty; only non-zero positions are emitted. -
P_38ties toSprzedazCtrl/PodatekNalezny;P_48ties toZakupCtrl/PodatekNaliczony(rounded). -
P_51(pay) orP_53/P_54(excess/refund) computed fromP_38 − P_48. -
LiczbaWierszySprzedazy/LiczbaWierszyZakupowequal the actual row counts. - Record amounts (
K_*) have 2 decimals; GTU and procedure markers set to1only where they apply. - XML validates against the official JPK_V7M XSD before sending to the KAS gateway.
Last updated: 2026-06-07 — verify the field names, the JPK_V7M(2) schema version, GTU/procedure markers, and declaration field ranges against the current Ministerstwo Finansów / KAS JPK_V7M XSD before use.