# Rulebook — Polish PIT-38, contract v1

You are reading this because someone asked you to compute their Polish capital-gains tax (PIT-38)
from broker exports. This page tells you exactly what to send us. Follow it literally.

**You do the reading. We do the tax.** You open the broker's file on the user's machine, convert
the rows into the shape below, and send us the numbers. We apply Polish tax law — FIFO cost
matching, National Bank of Poland exchange rates, PIT-38 and PIT/ZG sections — and return the
figure. For this calculation the file never leaves the user's machine.

**Jurisdiction:** Poland, Ustawa o podatku dochodowym od osób fizycznych. **Tax years:** any
`taxYear` from 2019 up to the current one — a year that has not started yet is refused
(`TAX_YEAR_IN_FUTURE`, §4). **Contract version:** v1 — a change that alters agent behaviour becomes
`/rulebook/pl/v2` rather than editing this page under anyone already relying on it.

*Clarified 2026-11-25: on `import` the tax of a tax year (`tax.years`) is given when that year has at most 10
sales (closed positions); buys, dividends, interest and currency conversions do not count. Over it the answer has
no tax and a `limit` with the year (`year`), its sales (`closedPositions`) and the limit (`max`). This replaces the
2026-11-24 statement that the tax is given when the import has at most 50 transactions.*
*Clarified 2026-11-24: what the assistant may do depends on the local-site plan — `access_status` gives
`access` per country: `full` (Ultra) every tool, `save` (Professional) a file import with saving and
adding transactions, `import` (every plan) a file import without saving, with a report of what was read
and the tax of one tax year (`tax.years`) when the import has at most 50 transactions. The calculation in this
rulebook still needs `full` (§1a, §11). This replaces the 2026-11-20 (2) statements that `access` is gone and that
every tool but `access_status` refuses without the Ultra plan.*
*Clarified 2026-11-20 (2): the assistant calculates only with the Ultra plan on podatekgieldy.pl;
without it every tool but `access_status` refuses with `PLAN_REQUIRED` and nothing is calculated —
there is no free calculation here, Starter and Professional included (§1a, §10, §11). `access`,
`purchase`, `free` and `FREE_TIER_LIMIT` are gone.*
*Clarified 2026-11-20: calculations for Poland come with the Ultra plan on podatekgieldy.pl;
`access_status` names the plan (§1a, §10).*
*Clarified 2026-11-18: access is per country, paid on the country's local site; what is free without
payment, the status tool, and the answers without a calculation (§1a, §10, §11); earlier years
carry over only from the rows sent (§1a). Packages, balance, saved earlier years and their codes are
gone.*
*Clarified 2026-11-11: the sign of withholding tax, account labels, dates of income, derivatives,
cryptocurrency and what `validate` checks now say exactly what the server does.*

---

## 1. What you must produce

One JSON object:

```json
{
  "contractVersion": "1",
  "jurisdiction": "PL",
  "taxYear": 2025,
  "transactions": [
    {
      "externalId": "175eefb6-200b-4773-b7f1-392e309de9ce",
      "type": "SELL",
      "instrument": { "isin": "US0378331005", "ticker": "AAPL", "exchange": "NASDAQ", "type": "STOCK" },
      "tradeDate": "2025-04-17",
      "settlementDate": "2025-04-21",
      "quantity": 10,
      "price": 172.35,
      "currency": "USD",
      "fees": [{ "amount": 1.02, "currency": "USD", "kind": "COMMISSION" }],
      "account": { "broker": "trading212", "accountId": "acc-1" },
      "sourceRef": { "row": 47 }
    }
  ]
}
```

`taxYear` is the year being declared. Include transactions from **all years**, not just that one —
a sale in 2025 needs its 2019 purchase to have a cost basis. Sending only one year silently
overstates the tax, because an unmatched sale is taxed on its full proceeds with no cost.

**One request per tax year must contain every broker and every account the person had.** Two
requests for the same year do not add up: a loss at one broker offsets a gain at another only
inside one calculation, and we keep nothing between requests to join them. If the person used XTB
and Revolut, read both exports and send them together.

Maximum 50 000 transactions per request, and at most 4 MB of request body on the wire — about
10 000 transactions as plain JSON. Over HTTP, send a larger request compressed
(`Content-Encoding: gzip`; up to 32 MB once unpacked). Over MCP the assistant cannot compress the
call, so about 10 000 transactions is the practical maximum there; a larger body is refused with
HTTP 413.

---

## 1a. Country and access

`jurisdiction` names the country whose tax we calculate. It is required; this rulebook is for
`"PL"`. A request without it is refused with `CONTRACT_INVALID` (`issues` names `jurisdiction`). A
country we do not calculate yet is not refused: the answer has `calculated: false`,
`reason: "JURISDICTION_UNSUPPORTED"`, `supported` (the countries we do calculate) and a `message`.
Nothing is calculated.

Access is per country, and it comes from the plan on that country's local site — for Poland, on
podatekgieldy.pl. A plan for one country opens no other. Over MCP, call `access_status` first. For
every country we calculate, its `jurisdictions` gives `access`, what the assistant may do for this
account, with `plan` (the local-site plan that opens everything), `savePlan` and `purchaseUrl`:

- `full` — for Poland, the Ultra plan: every tool, including the calculation in this rulebook
  (`rules`, `validate`, `calculate`).
- `save` — for Poland, from the Professional plan: a broker file imported and saved to the account,
  and transactions added (`import_file_preview`, `add_transactions_preview`, `apply_change`,
  `change_status`).
- `import` — every plan: `import_file_preview` only. It reports what the local site's import read
  from the file and gives the tax of one tax year (`tax.years`) when that year has at most 10 sales (closed
  positions; buys, dividends, interest and currency conversions do not count); nothing is saved.
- `null` — the level could not be read; try again.

Its `paid` lists the countries with `full`, each with `validUntil` (`null`: no end). One country
with `full`: use it. Several: ask the user which. None: tell the user the `message`, with the link,
and import the files instead of building the data — the calculation in this rulebook refuses with
`PLAN_REQUIRED` (§11), whose `details.plan` names the plan that opens it, and nothing is calculated.
The plan is what the local site records for the account at that moment, read on every call.

Losses of earlier years (Art. 9 ust. 3) and crypto costs of earlier years that income did not cover
(Art. 22 ust. 16) carry into `taxYear` only from the earlier years' transactions **in the same
request** — the local site does the same with the files the user uploads. We keep no
results of earlier years between requests. So send every earlier year in full — every sale and
every crypto row, not only the purchases of lots still open: a year carries over exactly what its
rows give. Using the transactions the user has saved on the local site is not available yet.

With `full` for the country, `calculate` gives the full calculation.

## 2. One transaction

```json
{
  "externalId": "175eefb6-200b-4773-b7f1-392e309de9ce",
  "type": "SELL",
  "instrument": { "isin": "US0378331005", "ticker": "AAPL", "exchange": "NASDAQ", "type": "STOCK" },
  "tradeDate": "2025-04-17",
  "settlementDate": "2025-04-21",
  "quantity": 10,
  "price": 172.35,
  "currency": "USD",
  "fees": [{ "amount": 1.02, "currency": "USD", "kind": "COMMISSION" }],
  "account": { "broker": "trading212", "accountId": "acc-1" },
  "sourceRef": { "row": 47 }
}
```

### Fields

| Field | Required | Rule |
|---|---|---|
| `externalId` | yes | The broker's own row identifier. If the export has none, build a stable one from the row's own content — never a sequence number that changes between exports |
| `type` | yes | Exactly one of `BUY`, `SELL`, `DIVIDEND`, `INTEREST` |
| `instrument.ticker` | yes | The symbol as the broker writes it. Never the security's name — see §7 |
| `instrument.isin` | if present | 12 characters, two letters then nine alphanumerics then a digit. Send it whenever the export has it — it is how we verify the instrument |
| `instrument.exchange` | if present | Market code or name |
| `instrument.type` | optional | `STOCK`, `ETF`, `BOND`, `CRYPTO`, `CASH`, `OTHER`. **Omit it unless the export states it** — with one exception: rows from a cryptocurrency exchange or a crypto statement are `CRYPTO`, even though the export does not say so (§3a). A security about crypto (an ETP or ETF with an ISIN) is not `CRYPTO`. Do not infer the type from the ticker — we verify against the ISIN and a wrong guess only adds noise |
| `tradeDate` | yes | `YYYY-MM-DD`, the day the trade happened. For dividends and interest see §4 |
| `settlementDate` | if present | `YYYY-MM-DD`. See §4 — **never invent it** |
| `quantity` | yes | Positive for `BUY` and `SELL`. Zero is allowed for `DIVIDEND` and `INTEREST` |
| `price` | yes | Price per unit, not the total |
| `currency` | yes | Three uppercase letters, the currency of `price`. Money only: known cryptocurrency codes (stablecoins too) and commodity codes such as `BTC`, `XAU` are refused (§3a) |
| `fees` | optional | Up to 10. All fees of one transaction share one currency. It may differ from the transaction's currency — send each fee in the currency the broker charged it (a EUR commission on a USD trade, a PLN currency-conversion fee); we convert it at the NBP rate ourselves. A fee charged in a cryptocurrency, in a commodity code such as `XAU`, or in a code NBP does not quote cannot be sent — leave it out and tell the user. If a transaction has fees in more than one currency, send only one currency: the fees in the transaction's currency if there are any, otherwise the fees in the currency of the first fee in the export's column order. Leave the rest out and tell the user which fees were not counted. `kind` is one of `COMMISSION`, `EXCHANGE` (currency conversion), `TAX` (a tax on the trade itself, e.g. FTT or stamp duty — not withholding tax) or `OTHER`. `amount` is never negative: a fee printed as `-1.02` is sent as `1.02` |
| `grossAmount` | for income | Required for `DIVIDEND` and `INTEREST`. See §5 |
| `withholdingTax` | if present | `{amount, currency}`. Only on `DIVIDEND` and `INTEREST` — a tax on a purchase or a sale itself (FTT, stamp duty) is a fee with `kind: "TAX"`. Currency must equal the transaction's, amount must not exceed `grossAmount`. The amount is never negative — see §5 |
| `account` | recommended | Send `broker` on every row; add `accountId` when the person has more than one account at that broker. Rows with neither `broker` nor `accountId` all count as one account. See §6 |
| `sourceRef` | optional | `{ "row": 47 }` — the row number as a spreadsheet would show it, header being row 1, so the first data row is 2. Nothing else goes here |

Any field not listed here will be **rejected**. The schema is strict at every level; there is no
place to put extra data, and that is deliberate.

---

## 3. Which rows to send and which to skip

**Send:** purchases, sales, dividends, interest.

**Skip entirely:** deposits, withdrawals, currency conversions between the user's own balances,
card transactions (a payment made with crypto is a sale — §3a), referral bonuses, and anything that
is not one of the four types above. They do not belong in PIT-38.

**Never send derivatives:** options, futures, swaps, CFDs, warrants, knock-outs and turbos,
structured products. Contract v1 cannot express a contract multiplier or whether a position was
opened or closed, and computing `quantity × price` for an option understates it roughly a
hundredfold.

If the export contains them, leave those rows out and send the rest. Then **tell the user, before
the figure, that it does NOT include these instruments and must not be filed until they are
added.** Our `calculationStatus` only describes what we received: a `COMPLETE` status does not
cover rows you left out.

The same goes for what v1 cannot express at all: corporate actions (splits, reverse splits,
mergers, spin-offs), employee shares (RSUs, grants, vesting) and transfers of securities between
accounts. Leave those rows out and name to the user the securities whose result is unreliable
because of them.

---

## 3a. Cryptocurrency

Crypto goes into its own section of PIT-38, apart from shares: its cost is the year's purchases in
total, not FIFO matching, and a loss on crypto does **not** reduce a gain on shares.

- Send a row only when crypto is bought or sold **for money**: `BUY` or `SELL`, `currency` the money
  it was paid in (`EUR`, `PLN`, `USD`…), `price` the price of one coin in that money, `quantity` the
  number of coins. A known cryptocurrency code or a commodity code such as `BTC` or `XAU` in
  `currency` is refused: a trade priced in a coin is a swap.
- **Coin-for-coin swaps are not sent** — including swaps into or out of USDT, USDC and other
  stablecoins. A swap of one coin for another is not a sale and is not taxed. We treat stablecoins
  as cryptocurrency, not as money: `USDT`, `USDC` and `DAI` are refused in `currency`. Buying USDC
  for euros is a `BUY` of `USDC` in `EUR`.
- Paying for goods or services with crypto is a sale. Send it as a `SELL` only if the export shows
  its value in money; never work that value out yourself — leave the row out and tell the user.
- Send **every** crypto purchase of the declared year, even if nothing was sold: the cost is the
  year's purchases in total. Send the purchases of earlier years too: without them a sale comes
  back as `MISSING_BUY_HISTORY` (§10), and their costs that income did not cover carry over (next
  point).
- The account does not split crypto purchases: a coin bought on one exchange and sold on another
  goes in as it is, with or without `accountId` (§6).
- Costs of earlier years that income did not cover (Art. 22 ust. 16) carry over only from the
  earlier years' crypto rows in the request (§1a). If the user had such costs and
  their years are not in the request, the tax comes out too high: tell the user, and do not present
  the figure as final.
- A fee charged in a coin (BNB, for example) cannot be sent — leave it out and tell the user (§2,
  `fees`).
- Staking, earn, airdrops and rewards: do not send them. Tell the user, before the figure, that
  these receipts are not included in it.
- For `binance`, `bybit`, `coinbase` and `revolut_crypto` in `account.broker` we file the rows as
  crypto even without `instrument.type`. For any other exchange, send `"type": "CRYPTO"` on every
  row.

---

## 4. Dates

`tradeDate` is the day the trade happened.

`settlementDate` is the day the money actually moves — usually two business days later for
equities. Polish law takes the exchange rate from the business day **before income is realised**,
which for a sale is the settlement day, not the trade day.

**Send `settlementDate` only if the broker's export contains it. Never compute or guess it.** If a
purchase or a sale has none, we compute it ourselves from the settlement cycle of the security's
market (T+1 or T+2, skipping days the market is closed) and return a `SETTLEMENT_DATE_COMPUTED`
correction of severity `info` with the day we used. That day also decides the tax year: a sale
struck on 31 December that settles in January is income of the next year — keep such rows when you
calculate that year.

For `DIVIDEND` and `INTEREST` the day of income is the payment date — the day the money reached
the account. Send it as `tradeDate` and **do not send `settlementDate`** for these types. We take the
tax year from `tradeDate` and the exchange rate from `settlementDate` when it is present, so a
second date would put the year and the rate on different days. If the row carries several dates
(ex-date, record date, booking date, payment or value date), use the payment date.

A time with a time zone (`2025-01-15T23:30:00Z`) → take the calendar date in Europe/Warsaw
(`2025-01-16`). A time without a zone → take the date as written.

**No date may be in the future, and neither may `taxYear`.** We accept dates up to tomorrow by UTC
(a broker in another time zone may already be on the next day); anything later is refused with
`DATE_IN_FUTURE` on that field. A trade from today whose settlement falls after tomorrow cannot be
counted yet — the NBP rate for it does not exist; leave it out and tell the user to count again
after that date. A `taxYear` that has not started is refused with `TAX_YEAR_IN_FUTURE`; the current
year is accepted as an estimate.

---

## 5. Dividends and interest

These have no share count to multiply, so the amount is explicit:

```json
{
  "externalId": "d1e2f3",
  "type": "DIVIDEND",
  "instrument": { "isin": "US0378331005", "ticker": "AAPL" },
  "tradeDate": "2025-05-15",
  "quantity": 0,
  "price": 0,
  "grossAmount": 100,
  "withholdingTax": { "amount": 19, "currency": "USD" },
  "currency": "USD",
  "fees": []
}
```

`grossAmount` is the amount **before** foreign withholding tax. If the export shows the net amount
received and the tax separately, add them: gross = net + withheld.

Getting this wrong has a direct cost. Omit `withholdingTax` and the user loses the foreign-tax
credit and overpays Polish tax. Send net as gross and their declared income is understated.

### Never use the broker's own converted amount

Many exports put two amounts on the same row: one in the instrument's currency, and one the broker
already converted into the account's currency — often złoty. **Take the first, never the second.**

Trading 212 does exactly this: a dividend row carries `Price / share` in USD and `Total` in PLN,
side by side. Sending `0.13` with `"currency": "PLN"` when the shares and the withheld tax are in
dollars produces a figure that is wrong and internally inconsistent.

The reason is not fussiness. Polish law fixes the exchange rate at the National Bank of Poland rate
for the business day before income is realised. A broker's own conversion used its own rate on its
own day. We compute the legal rate from the date you send — which is why there is nowhere in the
contract to put a converted amount, and why `currency` must be the currency the instrument actually
traded in.

So for a dividend where the export gives a per-share amount and a share count, compute
`grossAmount` as their product **in the instrument's currency**, and set `currency` to that
currency — the same one the withholding tax is in.

### Do not round anything

Send every number exactly as the export gives it, and send computed values at full precision.
`0.174052 × 0.176375` is `0.0306984215` — send that, not `0.03`.

This is not pedantry. Two assistants reading this page produced different figures for the same
dividend because one rounded to two decimal places and the other did not, and a different input is
a different tax. We round once, at the end, where Polish law says to. Rounding earlier also risks
turning a small dividend into `0.00`, which we reject outright.

### Withholding tax is sent as a positive number

Many brokers print tax withheld as a negative cash movement — Interactive Brokers in its
"Withholding Tax" section (e.g. `-0.38`), DEGIRO as a "Dividend Tax" row (e.g. `-3,60`). That is
tax withheld, not a refund: send its absolute value as `withholdingTax.amount` (`0.38`, `3.60`).

A refund or correction is a row that reverses an earlier withholding — labelled refund, correction
or reversal, or a positive amount in the tax section cancelling an earlier negative one. Contract
v1 cannot express it: leave it out and tell the user which dividend it belongs to.

`-0.00` is floating-point noise, not a real value: send `0` or omit the field.

When the tax stands on its own row, attach it to the dividend of the same security on the same
date: one `DIVIDEND` transaction with a `withholdingTax` field. There is no separate transaction
for tax.

Gross or net? If the dividend amount equals the per-share rate times the number of shares, it is
gross. If the export does not let you tell, send it as it is and tell the user.

### Unusual currency codes

Pence sterling — written `GBp`, `GBX` or `GBx` — always go as `GBX`. It is not an ISO-4217 code
but we recognise it and divide by one hundred ourselves. Do not convert pence to pounds yourself,
and do not substitute `GBP`. Every other code goes as three uppercase letters: `usd` → `USD`.

---

## 6. Accounts

```text
"account": { "broker": "trading212", "accountId": "acc-1" }
```

Polish law matches cost basis per investment account (art. 30b ust. 7 ustawy o PIT). If the user
holds the same stock at two brokers, the lots must not be mixed.

Send `broker` always — a short lowercase identifier. Capitals and spaces around it do not matter:
`XTB` and `xtb` are one broker.

`accountId` is **your own label for the account** — `acc-1`, `acc-2` — **never the broker's
account number.** Use the same label for the same account in every request.

We keep accounts apart by `broker` and `accountId` together. The label only has to tell apart the
accounts **within one broker**: the Trading 212 account and the Revolut account may both be `acc-1`,
but two Revolut accounts need two labels (`acc-1`, `acc-2`). If the person has a single account at a
broker, leave `accountId` out — `broker` alone is enough. Two accounts at one broker with no label,
or with the same label, are one account to us and their lots are mixed.

Put the same `broker` and `accountId` on every row of one account, sells included. A row without
`broker` is a different account from the same label with one.

This is about shares and ETFs. Crypto is not split by account (§3a).

---

## 7. What you must never send

The user's **name, surname, address, PESEL, tax identifier, account number, email, phone, document
number, or the file name**. Broker statements are routinely named after the account holder, which
is why the contract has no field for a file name.

There is nowhere to put these — the schema rejects unknown fields — but they can also be smuggled
inside allowed text fields. Do not do it. We scan `externalId`, `instrument.ticker`,
`instrument.exchange`, `account.broker` and `account.accountId` and reject a request carrying a
valid PESEL, a valid IBAN or an email address. In `externalId`, `instrument.ticker` and
`account.accountId` we also reject two or more words in a row written in capitals, each at least two
letters long — `JAN KOWALSKI` — as a possible name. A single word passes, and so do other spellings
of a name; that does not make them safe — never send names at all. You will get a refusal naming
the field, and you will have to resend.

Never put a security's name or any other free text into `instrument.ticker`. A company name in
capitals, such as `APPLE INC.`, looks like a person's name to our scanner, and the whole request
is refused. So does a ticker with an exchange suffix after a space — `VOD LN`, `AAPL US`: send the
ticker alone (`VOD`, `AAPL`); the market can go in `instrument.exchange`.

If the broker's row identifier itself contains something personal, replace it with a hash of the
row's content.

---

## 8. Worked example — Trading 212

Header:

```
Action,Time,ISIN,Ticker,Name,Notes,ID,No. of shares,Price / share,Currency (Price / share),
Exchange rate,Result,Currency (Result),Total,Currency (Total),Withholding tax,
Currency (Withholding tax),...
```

| Their column | Our field |
|---|---|
| `Action` = `Market buy` | `type: "BUY"` |
| `Action` = `Market sell` | `type: "SELL"` |
| `Action` = `Dividend (Dividend)` | `type: "DIVIDEND"` |
| `Action` = `Interest on cash` | `type: "INTEREST"` |
| `Action` = `Deposit`, `Currency conversion` | **skip the row** |
| `Time` | `tradeDate` — take the date part only, drop the time |
| `ISIN` | `instrument.isin` when non-empty |
| `Ticker` | `instrument.ticker` |
| `ID` | `externalId` |
| `No. of shares` | `quantity` |
| `Price / share` | `price` |
| `Currency (Price / share)` | `currency` for trades and dividends |
| `Currency (Total)` | `currency` for interest |
| `Withholding tax` + its currency | `withholdingTax` |
| `Total` | `grossAmount` for interest only. Otherwise **do not send** — for dividends it is Trading 212's own PLN conversion, not the instrument's currency, see §5 |
| `Currency conversion fee` | `fees: [{ amount, currency: Currency (Currency conversion fee), kind: "EXCHANGE" }]` — in the currency its own currency column states, which need not be the trade's |
| `Name`, `Notes` | **never send** — free text, may contain anything |

**Dividends.** `ID` is empty on every dividend row, so build `externalId` from a hash of the row's
own content. `Total` is in PLN while the shares, per-share amount and withheld tax are in the
instrument's currency — compute `grossAmount` as `No. of shares × Price / share` in that currency,
and leave `quantity` and `price` at zero as in the §5 example.

**Interest.** Rows have no ticker and no ISIN; use the currency as the ticker, for example `"PLN"`,
set `instrument.type` to `"CASH"`, and take `grossAmount` from `Total` — for interest that column
is already in the row's own currency.

**Settlement dates.** Trading 212 has no settlement-date column, so omit `settlementDate`; we
compute it and say so with a `SETTLEMENT_DATE_COMPUTED` correction. Do not derive it yourself.

**Currency conversion fees.** Trading 212 charges these in PLN on trades priced in other
currencies. Send them in PLN as they are; we count them as a cost. If a trade also carries a fee
in another currency (a stamp duty in GBP on a UK share), apply the rule from §2: send the fees in
the trade's currency if there are any, otherwise the fees in the currency of the first fee in
column order, and tell the user which fees were left out. Do not convert a fee yourself.

A real interest row:

```
Interest on cash,2025-01-01 02:05:58,,,,"Interest on cash",175eefb6-...,,,,,,,0.26,"PLN",,,...
```

becomes:

```json
{
  "externalId": "175eefb6-200b-4773-b7f1-392e309de9ce",
  "type": "INTEREST",
  "instrument": { "ticker": "PLN", "type": "CASH" },
  "tradeDate": "2025-01-01",
  "quantity": 0,
  "price": 0,
  "grossAmount": 0.26,
  "currency": "PLN",
  "fees": []
}
```

---

## 8a. A broker without a worked example

- Find the rows that are trades, dividends, interest and tax withheld. Skip subtotal and total
  rows and cash movements (§3).
- No action column: a negative quantity means `SELL`. Send the absolute value as `quantity`.
- Decimal commas become dots, thousands separators are removed, currency symbols are stripped:
  `$1.25` with a currency column of `USD` becomes `1.25`.
- No ticker column: use the ISIN as `instrument.ticker`, and send it in `instrument.isin` too.
  Never the security's name (§7).
- No row ID from the broker: build `externalId` as a prefix plus a hash of the row's own economic
  columns — date, type, instrument, quantity, price, amount. Never running balances or the
  broker's FX columns, so the ID survives a re-export. Start the prefix with letters (`ibkr-…`),
  so an 11-digit number never stands alone in it.
- Several files: `sourceRef.row` may repeat across them. That is fine — do not add file names.

---

## 9. Check before you send

`validate` checks these. It computes no tax:

1. Every date is a real calendar date `YYYY-MM-DD`, with no time part, and none is in the future; `taxYear` is from 2019 and not in the future either.
2. Every currency is three uppercase letters, and the transaction's `currency` is not a known cryptocurrency code or a commodity code such as `XAU` (§3a).
3. All fees of one transaction share one currency. A fee in a currency other than the trade's must have an NBP rate or be PLN — so not a cryptocurrency or a commodity code such as `XAU`.
4. `withholdingTax` is only on `DIVIDEND` and `INTEREST`; its currency equals the transaction's, and its amount does not exceed `grossAmount`.
5. Every `DIVIDEND` and `INTEREST` has `grossAmount` greater than zero.
6. Every `BUY` and `SELL` has `quantity` greater than zero.
7. No field the contract does not list — so no file name and no notes column — and no valid PESEL,
   valid IBAN, email address or two capitalised words in a row in the text fields (§7).

Only you can check these. `validate` sees what you sent, not what you left out or where a number
came from:

8. No derivatives, and the user knows the figure excludes them (§3).
9. Prior-year purchases are included, not only the declared year.
10. Deposits, withdrawals and currency conversions are excluded.
11. No amount was taken from a column the broker had already converted into another currency.
12. No exchange rate and no złoty amount is anywhere in the request — there is nowhere to put them.
13. Every broker and every account the person had is in this one request (§1), every row with its
    `broker`, and accounts at the same broker with different labels (§6).
14. No name in any other spelling, no account number, no free text anywhere.

Call `validate` first. Fix what it reports, and only then call `calculate`.

`validate` also runs the calculation without exchange rates and tells you whether it will be
complete, before the tax is calculated. It returns `check`: `calculationStatus`, `incompleteReasons`
and `corrections` (for example a sale with no purchase in the data, `MISSING_BUY_HISTORY`), and
`notChecked: ["NBP_RATES"]` — a missing NBP rate shows only on `calculate`. It returns no amounts.
When the result would be incomplete, `completeness` carries the reasons in the user's language;
show them and ask for the missing export before calculating. If this check could not run,
`warnings` carries `COMPLETENESS_UNAVAILABLE` and the contract check above still holds.

---

## 10. What comes back, and what you must show the user

The response carries the tax figure, the form positions, and the things you are expected to relay, not summarise away.
The calculation itself is in `outcome`; next to it are `calculated: true`, `jurisdiction`,
`requestId` and `warnings`.

One answer carries no calculation and is not an error (§1a):

- `calculated: false`, `reason: "JURISDICTION_UNSUPPORTED"` — we do not calculate that country yet:
  `jurisdiction` is the one sent, `supported` the ones we calculate, and `message` says so. Tell the
  user; do not compute the tax yourself.

**`forms`** — for tax year 2025: the positions of PIT-38(18) and of each PIT/ZG(8) attachment.
`forms.markdown` is a ready table of them, built by us: one row per cell of the form, the caption
printed on the form, the amount written the Polish way, the tax rate rows, the result (poz. 51 or
52) and one table per PIT/ZG attachment. The user copies it into the form cell by cell.

- **Show `forms.markdown` to the user exactly as it is.** Do not rebuild it from the positions, do
  not merge rows, shorten or translate captions, or drop rows that are zero. If the user writes
  another language, add a short translation of the headings after the table, not inside it.
- If `calculationStatus` is not `COMPLETE`, the table starts with a warning: keep it, and explain
  the reasons as described below.
- `forms.pit38.positions` and `forms.pitZg[].positions` carry the same numbers as data — `poz`,
  `label`, `value`, `denomination` (`zloty`: whole złote, `grosz`: złote and grosze) — for scripts.
- **Sales reported in PIT-8C.** Every sale of securities you sent is in row 2, poz. 22–23. Row 1,
  poz. 20–21, is for sales that a Polish broker reported in PIT-8C, and Twój e-PIT fills it from
  PIT-8C by itself. If any sale you sent went through such a broker, do not present the tables as
  ready to file. Tell the user that those sales belong in poz. 20–21 with the amounts from PIT-8C
  and must come out of poz. 22–23, otherwise they are counted twice; and that if the PIT-8C amounts
  differ from the ones calculated here, poz. 26–35 and 51 change too. Splitting them is not
  supported yet.

Without `forms` (another tax year) there are no position numbers: show `sections` and say that
the form positions are not available for that year.

**`corrections`** — where our server overrode what you sent, and why. A `critical` correction means
the tax changed or the transaction moved between declaration sections. Show critical corrections
**before** the figure, not after it. Example: *"row 47: you said crypto, ISIN US0378331005 is a
share — corrected, this changes the declaration section."*

**`calculationStatus` and `incompleteReasons`** — if the status is not complete, the figure is
unreliable. The usual cause is `MISSING_BUY_HISTORY`: a sale whose purchase was never sent, which
makes the tax come out **too high** because the sale gets no cost basis. When you see this, say so
plainly and ask the user for the earlier export rather than presenting the number as final.

**`outcome.dttWarnings`** — notes about foreign tax on dividends and interest: more withheld than
the treaty allows, an unknown country, no treaty, an Irish fund. Over MCP the same notes come as
ready sentences in `notices`, and an incomplete result comes with `completeness` — its reasons in
the user's language. Show both as they are.

**`warnings`** — on `validate` and `calculate`. Each has a `path` and a `code`.

`LONG_DIGIT_RUN`: the field at `path` holds a long run of digits that may be an identifier. Not
fatal, but tell the user and check that it is not personal data.

`COMPLETENESS_UNAVAILABLE` (only on `validate`): the completeness check (§9) could not run, so the
response has no `check`. The data passed the contract; whether the result will be complete you
learn from `calculate`.

`CARRYFORWARD_YEAR_FAILED` (it has the `years` it names and a `message` in the language of the
request): the named earlier years in the request could not be calculated, so nothing from them is
carried over and the tax may be too high — show the message, and check those years' rows before
calculating again.

`ACCOUNT_INCONSISTENT` (it has a `path`, no `years`): the `path` is the first row of one security
whose account differs in shape from that security's first row — some of its rows carry a broker
(or an account label), others do not. The rows without them are one account to us and the rows
with them another, and FIFO matches each account on its own: a sale can be paid for by a purchase
from the wrong account while the status stays `COMPLETE`. The figure was calculated as you sent it,
so do not show it yet: put the same broker and account label on every row of that account (§6) and
send again. `validate` shows this warning too, so fix it there, before calculating. If you cannot tell which account a row belongs to, ask the
user instead of guessing, and name the security. Different brokers on one security are fine and do
not trigger it; nor does crypto.

Also relay that this is a computation tool, not tax advice.

---

## 11. If something is refused

You get a machine-readable `code` and a message: for `PLAN_REQUIRED` in the request's language
(`Accept-Language`), for most other codes in Polish. A country we do not calculate is not a
refusal: it is an answer with `calculated: false` (§1a).
Every code:

| Code | Meaning |
|---|---|
| `CONTRACT_INVALID` | A field is wrong. `issues` lists each field by `path` with a `code` and a message — besides the schema's own codes, `DATE_IN_FUTURE` and `TAX_YEAR_IN_FUTURE` (§4) and `too_big` (more than 50 000 transactions). Also a body that is not JSON, or too large (HTTP 413, §1) |
| `PII_DETECTED` | Personal data found. `issues` names the field but never repeats the value |
| `UNAUTHORIZED` | Not signed in, or the sign-in no longer works. Over MCP, the user signs in again |
| `ACCOUNT_CLOSED` | The account is blocked or closed on Podatek Giełdy. Signing in again will not help: tell the user to contact Podatek Giełdy support |
| `DOCUMENTS_NOT_ACCEPTED` | The user has not accepted the current Podatek Giełdy documents. The message has the link: tell the user, then try again |
| `RATE_LIMITED` | Too many requests. `Retry-After` (and `resetsAt` on `validate`) says when to try again |
| `CALC_REJECTED` | The data fits the contract but cannot be calculated as sent; the message says why — for example no NBP rate for a currency and day. Fix the data; resending the same request will not help |
| `CALC_UNAVAILABLE` | Our side failed, or NBP did not answer. Your data is fine; try again in a few minutes |
| `CALC_MALFORMED` | Our calculation service returned a broken answer. Try again in a few minutes |
| `PLAN_REQUIRED` | The account's plan does not open this: the calculation and the saved data need the plan with full AI-agent access — for Poland, the Ultra plan on podatekgieldy.pl; saving an import and adding transactions need the Professional plan. Nothing was calculated or saved. `details` carries `plan` (the plan that opens it) and `url`: tell the user the message with the link; do not retry and do not compute the tax yourself |
| `PERMISSION_REQUIRED` | This connection does not have the permission for that saved data or that change; the user ticks permissions when connecting and in Settings → MCP on podatekgieldy.pl. Nothing was read or changed. `details` carries `permission` and `url`: tell the user the message; do not retry until they have turned it on |
| `ACCOUNT_PAUSED` | Access through the assistant to this account is paused for a while (it looks used from many places at once). The message says until when and where to write: tell the user the message; do not retry |

Over MCP, a sign-in that is missing or no longer valid is answered with HTTP 401 before any tool
runs; a closed account, documents not accepted, or access through the assistant paused for the account, with HTTP 403 and the reason in the message — tell the user the message; do not retry. One account may make four calls at the same time and 600 an hour; past that a call gets
HTTP 429 with JSON-RPC error `-32000` and `Retry-After` in seconds. `validate` has its own limit of
60 an hour (`RATE_LIMITED`).

---

## 12. The one thing worth repeating

We are the tax authority in this exchange, not you. We compute the exchange rates ourselves from
the dates you send — do not send rates or złoty amounts, there is nowhere to put them. We verify
the instrument type against the ISIN. We decide the declaration section.

Your job is to read the file accurately and describe what you found. Ours is to be right about
Polish tax law.
