Download statements and tax pack
Goal: after the tax year ends, collect everything an accountant needs. Scope: read. Every report is
generated from the ledger when you ask, so it always matches the account’s activity.
- Your job to IDEALX API: GET /v1/accounts/{id}/reports/tax?year=2026
- IDEALX API to Your job: sales lot by lot, income, interest, fees
- Your job to IDEALX API: GET /v1/accounts/{id}/documents/annual.pdf?year=2026
- Your job to IDEALX API: GET /v1/accounts/{id}/reports/statement?format=csv
- Your job to IDEALX API: GET /v1/accounts/{id}/activity/report?format=xlsx
- Your job to Your storage: Save files with the account and year
Which report
Section titled “Which report”| You need | JSON | Files |
|---|---|---|
| Everything in a period, per portfolio and line | reports/statement |
?format=csv |
| A bank-style statement for one currency | reports/cash-statement |
reports/cash-statement.csv, documents/statement.pdf |
| The tax year: sales lot by lot, income, interest, fees | reports/tax |
?format=csv, documents/tax.pdf |
| The annual pack: performance, statement and tax year | reports/annual |
documents/annual.pdf |
| Positions now with value | positions |
documents/holdings.pdf, documents/holdings.csv |
| Fees charged in a year | fees |
documents/fees.pdf |
| Any filtered activity | activity |
activity.csv, activity/report (PDF, CSV or Excel) |
All paths are under /v1/accounts/{id}/.
1. The tax year
Section titled “1. The tax year”/v1/accounts/{id}/reports/taxThe tax year in the account's country: sales lot by lot, and income; ?format=csv
year is the year the tax year ends in, in the account’s country (Australia 2026: 1 July 2025 to 30 June
2026). Without it you get the last full tax year.
curl "$IDEALX_API/v1/accounts/acc_01937c4e8a2b7d1f9e0c3b5a6d7e8f90/reports/tax?year=2026" -H "Authorization: Bearer $IDEALX_API_KEY"{ "jurisdiction": "AU", "estimated": true, "notice": "Estimated from your IDEALX records. Not tax advice.", "year": 2026, "label": "FY2025–26", "from": "2025-07-01", "to": "2026-07-01", "capitalGains": { "method": "fifo", "holdingPeriodMonths": 12, "longTermLabel": "Held 12 months or more" }, "sales": [ { "instrumentId": "XASX:EXW", "quantity": "20", "acquiredAt": "2024-09-03", "soldAt": "2026-02-17", "heldDays": 532, "heldOver12Months": true, "longTerm": true, "matching": "lot", "cost": { "amount": "2410.00", "currency": "AUD" }, "proceeds": { "amount": "2788.40", "currency": "AUD" }, "gain": { "amount": "378.40", "currency": "AUD" }, "inAccountCurrency": { "cost": { "amount": "2410.00", "currency": "AUD" }, "proceeds": { "amount": "2788.40", "currency": "AUD" }, "gain": { "amount": "378.40", "currency": "AUD" } } } ], "income": [ { "instrumentId": "XASX:EXS", "kind": "dividend", "payDate": "2026-01-15", "amount": { "amount": "212.60", "currency": "AUD" } } ], "interest": [], "fees": [ { "date": "2026-06-30", "description": "Platform fee, June", "amount": { "amount": "8.40", "currency": "AUD" } } ]}tois the day after the tax year ends.capitalGains.methodis the country’s matching method:fifo(lots, oldest first),share_pooling(the United Kingdom’s rules;matchingthen sayssame_day,bed_and_breakfastorpool) ornone.longTermfollows the country’s holding period, shown only: no discount is applied. Figures are estimates, not tax advice, and the PDF says so.
2. Download the files
Section titled “2. Download the files”ACC=acc_01937c4e8a2b7d1f9e0c3b5a6d7e8f90H="Authorization: Bearer $IDEALX_API_KEY"curl -fsS -o tax-2026.pdf "$IDEALX_API/v1/accounts/$ACC/documents/tax.pdf?year=2026" -H "$H"curl -fsS -o tax-2026.csv "$IDEALX_API/v1/accounts/$ACC/reports/tax?year=2026&format=csv" -H "$H"curl -fsS -o annual-2026.pdf "$IDEALX_API/v1/accounts/$ACC/documents/annual.pdf?year=2026" -H "$H"curl -fsS -o statement.csv "$IDEALX_API/v1/accounts/$ACC/reports/statement?from=2025-07-01&to=2026-06-30&format=csv" -H "$H"curl -fsS -o holdings.pdf "$IDEALX_API/v1/accounts/$ACC/documents/holdings.pdf" -H "$H"import { writeFile } from "node:fs/promises";
async function download(path: string, file: string) { const res = await fetch(`${process.env.IDEALX_API}${path}`, { headers: { Authorization: `Bearer ${process.env.IDEALX_API_KEY}` }, }); if (!res.ok) throw new Error(`${res.status} ${(await res.json()).error.code}`); await writeFile(file, Buffer.from(await res.arrayBuffer()));}
const acc = "acc_01937c4e8a2b7d1f9e0c3b5a6d7e8f90";await download(`/v1/accounts/${acc}/documents/tax.pdf?year=2026`, "tax-2026.pdf");await download(`/v1/accounts/${acc}/documents/annual.pdf?year=2026`, "annual-2026.pdf");await download(`/v1/accounts/${acc}/reports/statement?from=2025-07-01&to=2026-06-30&format=csv`, "statement.csv");def download(path: str, file: str, **params) -> None: res = requests.get(f"{base}{path}", params=params, headers=headers, timeout=120) res.raise_for_status() with open(file, "wb") as f: f.write(res.content)
acc = "acc_01937c4e8a2b7d1f9e0c3b5a6d7e8f90"download(f"/v1/accounts/{acc}/documents/tax.pdf", "tax-2026.pdf", year=2026)download(f"/v1/accounts/{acc}/documents/annual.pdf", "annual-2026.pdf", year=2026)download(f"/v1/accounts/{acc}/reports/statement", "statement.csv", **{"from": "2025-07-01", "to": "2026-06-30", "format": "csv"})PDFs answer application/pdf, CSVs text/csv. Errors still answer JSON with the usual shape.
3. A statement for any period
Section titled “3. A statement for any period”/v1/accounts/{id}/reports/statementA statement for a period: opening, every movement, closing; ?format=csv for a spreadsheet
curl "$IDEALX_API/v1/accounts/acc_01937c4e8a2b7d1f9e0c3b5a6d7e8f90/reports/statement?from=2026-10-01&to=2026-10-31" \ -H "Authorization: Bearer $IDEALX_API_KEY"{ "accountName": "Sam Taylor", "from": "2026-10-01", "to": "2026-10-31", "portfolios": [ { "id": "ptf_01937c4e8a2b7d1f9e0c3b5a6d7e8fa1", "name": "Primary", "lines": [ { "instrumentId": "AUD", "symbol": "AUD", "name": "Australian dollar", "isCash": true, "opening": "17050.40", "closing": "18250.40", "reconciled": true, "movements": [ { "at": "2026-10-02T23:01:44.000Z", "kind": "deposit", "description": "Deposit from S TAYLOR", "units": "1500.00", "balance": "18550.40" }, { "at": "2026-10-15T00:10:05.000Z", "kind": "transfer", "description": "To Long term", "units": "-300.00", "balance": "18250.40" } ] } ] } ]}Each line opens, moves and closes; reconciled: true means opening plus movements equals closing in the ledger.
4. Activity as a spreadsheet
Section titled “4. Activity as a spreadsheet”GET /v1/accounts/{id}/activity/reportThe filtered activity feed as a named file: a branded PDF (at most 10000 rows), CSV or Excel workbook (D152) takes every filter of the activity feed plus
format (pdf, csv or xlsx), a name, columns and summary. The file name comes from the report’s name and
today’s date (Content-Disposition). At most 20 reports a minute per person, 10,000 rows per file.
curl -fsS -OJ "$IDEALX_API/v1/accounts/acc_01937c4e8a2b7d1f9e0c3b5a6d7e8f90/activity/report?period=fy&format=xlsx&name=Year%20activity" \ -H "Authorization: Bearer $IDEALX_API_KEY"Checklist
Section titled “Checklist”- Run year-end jobs after the account’s tax year has ended in its own time zone.
- Store files with the account id, the tax
yearand the date you fetched them. - Show the
noticewith tax figures: they are estimates, not tax advice. - For bookkeeping software, use the accounting exports instead: see Export to accounting software (the same endpoints work with a personal key).