DocumentationReference
HTTP API
Two endpoints: check and calculation. The same operations as the MCP tools.
On this page
The assistant connects over MCP. The same operations are also available directly over HTTP and compute the same way.
The request body is contract v1, described in the rules v1. The response is always JSON with an ok field.
POST https://taxroam.com/api/validate
POST https://taxroam.com/api/calculatecalculate needs a sign-in, validate does not.
Sign-in in a header #
/api/calculate carries the Podatek Giełdy account's sign-in token in the Authorization: Bearer … header, the same one as over MCP. Without it, or with a token that does not work: 401 UNAUTHORIZED.
$TAXROAM_TOKEN in the examples is an access key: create the key on podatekgieldy.pl in Settings → MCP («New key»), where it is shown only once, and treat it like a password.
We check the sign-in before reading the body: without it the body is not accepted.
HTTP/1.1 401 Unauthorized
{
"ok": false,
"code": "UNAUTHORIZED",
"message": "Zaloguj się kontem Podatku Giełdy: Authorization: Bearer <token>."
}The request body #
validate and calculate take the whole contract v1 as the body: the same object that goes in the payload argument over MCP.
| Limit | Value | Above it |
|---|---|---|
| Transactions in one request | 50 000 | 422 CONTRACT_INVALID, with the rule too_big in issues. |
| Body on the wire | 4 MB | 413 CONTRACT_INVALID. |
| Body after gzip unpacking | 32 MB | 413. A body that cannot be unpacked: 400. |
A body that is not valid JSON gets 400 CONTRACT_INVALID. Send a larger request compressed, with the Content-Encoding: gzip header: 50 000 transactions are about 20 MB of plain JSON and 1.5 MB in gzip.
The Accept-Language header (pl or en) chooses the language of corrections and incompleteness reasons in validate and calculate; without it, Polish. It also sets the language of the PLAN_REQUIRED message; most other refusal messages are in Polish.
{
"contractVersion": "1",
"jurisdiction": "PL",
"taxYear": 2025,
"transactions": [{
"externalId": "175eefb6-200b-4773-b7f1-392e309de9ce",
"type": "SELL",
"instrument": { "isin": "US0378331005", "ticker": "AAPL" },
"tradeDate": "2025-04-17",
"settlementDate": "2025-04-21",
"quantity": 10,
"price": 172.35,
"currency": "USD",
"account": { "broker": "trading212", "accountId": "acc-1" }
}]
}gzip -k data.jsoncurl https://taxroam.com/api/calculate \
-H "Authorization: Bearer $TAXROAM_TOKEN" \
-H "Content-Type: application/json" \
-H "Content-Encoding: gzip" \
-H "Accept-Language: pl" \
--data-binary @data.json.gzPOST /api/validate #
Checks the contract and personal data, then computes without NBP rates whether the result will be complete. It computes no tax and needs no sign-in.
Limit: 60 calls an hour from one IP address. Above it: 429 RATE_LIMITED with a Retry-After header and a resetsAt field.
| Field | Meaning |
|---|---|
| transactionCount | How many transactions arrived. |
| taxYear | The year from the contract. |
| warnings | Warnings { path, code }, for example LONG_DIGIT_RUN. They do not block. |
| check | Completeness without amounts: calculationStatus, incompleteReasons, corrections, notChecked. No field: the check could not run, and warnings holds COMPLETENESS_UNAVAILABLE. |
| completeness | Only when the result would be incomplete: the reasons in words. |
curl https://taxroam.com/api/validate \
-H "Content-Type: application/json" \
-d @data.jsonHTTP/1.1 200 OK
{
"ok": true,
"transactionCount": 1,
"taxYear": 2025,
"warnings": [],
"check": {
"calculationStatus": "INCOMPLETE",
"incompleteReasons": [{ "code": "MISSING_BUY_HISTORY", "count": 1 }],
"corrections": [],
"notChecked": ["NBP_RATES"]
},
"completeness": { "status": "INCOMPLETE", "message": "…", "reasons": […] }
}POST /api/calculate #
Computes the tax of the country in jurisdiction, like the calculate tool, only for a country for which the account has the Ultra plan on its site. Without it: 403 PLAN_REQUIRED and nothing is computed. For a country we do not compute: calculated: false.
| Field | Meaning |
|---|---|
| outcome | The result: taxDue, the sections breakdown, server corrections corrections, calculationStatus with incompleteReasons, notes on foreign tax dttWarnings, engineVersion. |
| outcome.forms | PIT-38 and PIT/ZG positions, only for a year whose form numbering we know. forms.markdown is a ready table: show it unchanged. |
| calculated | Whether it was computed; with false the reason field says why. |
| requestId | The identifier of this calculation. |
| warnings | Warnings, including when an earlier year in the data could not be calculated for the carry-forward. |
| completeness | Only for an incomplete result: the reasons in words. |
| notices | Only when there are any: notes on foreign tax in words. |
curl https://taxroam.com/api/calculate \
-H "Authorization: Bearer $TAXROAM_TOKEN" \
-H "Content-Type: application/json" \
-H "Content-Encoding: gzip" \
-H "Accept-Language: pl" \
--data-binary @data.json.gzHTTP/1.1 200 OK
{
"ok": true,
"calculated": true,
"access": "paid",
"jurisdiction": "PL",
"outcome": {
"taxYear": 2025,
"taxDue": …,
"calculationStatus": "INCOMPLETE",
"incompleteReasons": [{ "code": "MISSING_BUY_HISTORY", "count": 1 }],
"sections": { … },
"forms": { "markdown": "…", … },
"corrections": [],
"dttWarnings": [],
"engineVersion": "…"
},
"requestId": "…",
"warnings": [],
"completeness": { "status": "INCOMPLETE", … }
}Responses and refusal codes #
With ok: true the operation's data sits next to it. With ok: false: code, which your script branches on, message (mostly in Polish; PLAN_REQUIRED follows Accept-Language) and, depending on the code, issues, resetsAt or details.
issues name the field (path) and the rule (code) and never repeat the value you sent. Every code:
| Code | HTTP | Meaning and what to do |
|---|---|---|
| UNAUTHORIZED | 401 | Not signed in, or the sign-in token does not work. Sign in again. |
| ACCOUNT_CLOSED | 403 | The account is blocked or closed on Podatek Giełdy. Signing in again will not help: contact Podatek Giełdy support. |
| DOCUMENTS_NOT_ACCEPTED | 403 | The Podatek Giełdy documents are not accepted. The message has the link: accept them and try again. |
| PLAN_REQUIRED | 403 | The account’s plan does not include this (for Poland: saving transactions comes with the Professional plan, everything beyond a file import with the Ultra plan on podatekgieldy.pl). Nothing was calculated or saved. details carries the plan that opens it and url. |
| PERMISSION_REQUIRED | 403 | The connection does not have the permission for this saved data or this change: permissions are ticked when connecting and in Settings → MCP on podatekgieldy.pl. Nothing was read or changed. details carries permission and url. |
| ACCOUNT_PAUSED | 403 | Access through the assistant to the account is paused for now: it looks used from many places at once. The message says until when and links to contact. Retrying will not help. |
| CONTRACT_INVALID | 422 | A field is wrong: issues list each by path with its rule. Also a body that is not JSON (400) or is too large (413). |
| PII_DETECTED | 422 | Personal data found. issues name the field and never repeat the value. |
| CALC_REJECTED | 422 | The data fits the contract but cannot be computed as sent; the message says why, for example no NBP rate for a currency and day. Fix the data: the same request again will not help. |
| RATE_LIMITED | 429 | Too many requests. Retry-After (and resetsAt on validate and calculate) says when to try again. |
| CALC_MALFORMED | 502 | Our calculation service returned a broken answer. Try again in a few minutes. |
| CALC_UNAVAILABLE | 503 | Our side failed, or NBP did not answer. Your data is fine: try again in a few minutes. |
HTTP/1.1 422 Unprocessable Entity
{
"ok": false,
"code": "CONTRACT_INVALID",
"message": "Dane nie pasują do kontraktu.",
"issues": [{
"path": "transactions[0].tradeDate",
"code": "DATE_IN_FUTURE",
"message": "Data jest w przyszłości. Wyślij tylko transakcje, które już się odbyły."
}]
}