# Talia Statement Format

A JSON file format for statements that Talia imports without guessing, written for agents
and scripts that read an account at its institution and hand Talia the result. A file
describes **one account**: a bank or card statement's transactions and balances, or an
investment account's holdings on a date and its activity over a period. An investment
file can carry both, as an OFX investment statement does. Several accounts at once go in
a zip of these files, one or more per account ([§6](#6-several-accounts-a-zip)).

Everything a CSV import has to infer or ask — which column is which, date order, sign
convention, what a broker's wording means, what the export covers — the file states.

> Status: version 1, released. The [JSON Schema](https://talia.money/schemas/talia.statement/1.json) is
> the machine-readable form of this document; where they disagree, this document is right
> and the schema is a bug. How versions change, and what stays readable, is
> [§7](#7-versions).

---

## 1. Rules that apply everywhere

| | Rule |
|---|---|
| Encoding | UTF-8 JSON, one object at the top level. At most 10 MB, as for every statement |
| Version | `"format": "talia.statement/1"`, required. Talia reads every released version and rejects one it doesn't know with "Update Talia to import this file" rather than reading part of it ([§7](#7-versions)) |
| Unknown keys | **An error.** A misspelt `"withholdings"` would otherwise vanish silently and break the arithmetic. Anything an agent wants to keep for itself goes under `"x"` at any level, which Talia ignores |
| Money | A **decimal string**: `"-1234.50"`. Optional `-`, digits, optional `.` and digits. No `+`, exponent, currency symbol, spaces or thousands separators. JSON numbers are rejected, since a float cannot hold `0.10` exactly. Fraction digits beyond the currency's (2 for USD, 0 for JPY) must be zeros |
| Quantities, prices | Decimal strings, same grammar, any precision. Quantities are stored to 8 decimals; the text as written is kept beside them |
| Dates | `"YYYY-MM-DD"`, a real calendar date. No times, no zones: the date the institution shows |
| Currencies | ISO 4217, upper case: `"USD"`, `"CAD"`. Crypto assets are securities, not currencies |
| Signs | **From the account holder's side, always.** Money into the account is positive, money out negative. A card purchase is negative; a card's balance owed is negative. Talia never flips a sign in this format |
| Order | Arrays may be in any order. Talia sorts by date and keeps the file's order within a day |

---

## 2. The envelope

```json
{
  "format": "talia.statement/1",
  "generator": "acme-scraper 0.3.1",
  "account": {
    "type": "investment",
    "currency": "USD",
    "institution": "Fidelity",
    "name": "Individual Brokerage",
    "mask": "4821"
  },
  "period": { "start": "2026-09-01", "end": "2026-09-30" }
}
```

| Key | Required | Meaning |
|---|---|---|
| `format` | yes | `"talia.statement/1"`: the format and the version the file is written in ([§7](#7-versions)) |
| `generator` | no | What wrote the file, for your own debugging. Talia doesn't store it |
| `account.type` | yes | `banking`, `credit`, `investment` or `crypto`. Must match the kind of account the file is imported into: `banking`/`credit` into a bank or card account, `investment`/`crypto` into an investment or crypto account |
| `account.currency` | yes | The account's currency. Must equal the Talia account's; otherwise the import stops, as for a CSV in the wrong currency |
| `account.institution`, `account.name` | no | As the institution names them. Shown in review |
| `account.mask` | no | The last 2–4 digits of the account number. Talia warns when it doesn't match the account's own mask. Never put a full account number in a file |
| `period` | see below | The dates the file covers, inclusive. Required with `transactions` or `activity`; a holdings-only file has none |

A file carries `transactions` (bank and card accounts) **or** `holdings` and/or
`activity` (investment and crypto accounts), never both kinds.

---

## 3. Bank and card statements

```json
{
  "format": "talia.statement/1",
  "account": { "type": "credit", "currency": "CAD", "institution": "RBC", "mask": "0114" },
  "period": { "start": "2026-09-05", "end": "2026-10-04" },
  "opening": "-412.18",
  "closing": "-122.51",
  "transactions": [
    { "id": "2026090500123", "date": "2026-09-06", "amount": "-58.21", "description": "LOBLAWS #1123 TORONTO ON" },
    { "date": "2026-09-20", "amount": "412.18", "description": "PAYMENT - THANK YOU" },
    { "date": "2026-09-28", "amount": "-64.30", "description": "SHELL C04512 TORONTO ON" },
    { "date": "2026-10-03", "amount": "-14.99", "description": "NETFLIX.COM", "pending": true }
  ]
}
```

| Key | Required | Meaning |
|---|---|---|
| `opening` | no | The balance at the start of `period`, before its first transaction |
| `closing` | no | The balance at the end of `period`, after its last |
| `transactions[].date` | yes | The posted date |
| `transactions[].amount` | yes | Signed, holder's side |
| `transactions[].description` | yes | As the institution prints it, untouched. Talia derives the merchant from it; don't clean it up |
| `transactions[].balance` | no | The running balance after this transaction, where the institution shows one. Lets Talia pinpoint a missing row |
| `transactions[].id` | no | The institution's transaction id. Unique within the file |
| `transactions[].pending` | no | `true` for a transaction that hasn't posted. Talia skips it; it will appear, posted, in a later file |

**State both balances when you can see them.** Talia checks `opening` plus the
transactions against `closing`. With both, the import is verified on its own; with only
`closing`, Talia uses the previous import's close as the opening, and asks the user when
there is none. Give the balances the institution states for the period. Don't compute
them from the transactions, because then they can't catch a missing one.

A transaction dated outside `period` is flagged for review, not rejected.

---

## 4. Investment and crypto accounts

```json
{
  "format": "talia.statement/1",
  "account": { "type": "investment", "currency": "USD", "institution": "Fidelity", "mask": "4821" },
  "period": { "start": "2026-09-01", "end": "2026-09-30" },
  "coverage": { "securities": true, "cash": true, "flows": true, "income": true },

  "securities": {
    "vti": { "symbol": "VTI", "exchange": "ARCX", "isin": "US9229087690", "name": "Vanguard Total Stock Market ETF", "kind": "fund" },
    "spaxx": { "symbol": "SPAXX", "name": "Fidelity Government Money Market", "kind": "fund" }
  },

  "holdings": {
    "asOf": "2026-09-30",
    "complete": true,
    "quantities": "settled",
    "positions": [
      { "security": "vti", "quantity": "120.5", "price": "291.40", "marketValue": "35113.70", "costBasis": "30120.00" },
      { "security": "spaxx", "quantity": "1204.18", "price": "1.00", "marketValue": "1204.18" }
    ],
    "cash": [{ "currency": "USD", "amount": "0.00" }],
    "total": "36317.88"
  },

  "activity": [
    { "id": "88123", "kind": "transfer_in", "date": "2026-09-02", "amount": "3000.00", "description": "EFT FROM CHECKING" },
    { "id": "88124", "kind": "buy", "date": "2026-09-12", "settles": "2026-09-15",
      "security": "vti", "quantity": "10", "price": "288.10", "amount": "-2881.00" },
    { "id": "88140", "kind": "dividend", "date": "2026-09-25", "security": "vti", "amount": "72.35", "withholding": "12.77" },
    { "id": "88141", "kind": "buy", "reinvests": "88140", "date": "2026-09-25",
      "security": "vti", "quantity": "0.2483", "price": "291.40", "amount": "-72.35" }
  ]
}
```

### 4.1 Securities

`securities` names every security the file mentions, once, under a key the file chooses
(`"vti"`, `"s1"`, anything). Positions and activity refer to that key.

| Key | Meaning |
|---|---|
| `symbol` | The ticker as the institution shows it |
| `exchange` | The ISO 10383 MIC of the listing (`XNAS`, `ARCX`, `XTSE`), only if you know it. A symbol with an exchange is matched to Talia's securities directly; a symbol without one is matched only within this institution |
| `isin`, `cusip` | Where the institution shows them. These identify a security best of all: include them whenever you can see them |
| `name` | As the institution names it |
| `kind` | `equity`, `fund`, `bond`, `gic`, `option`, `crypto` or `other`. Decides whether Talia can price it; bonds, options and GICs are held at their reported value |
| `priceMultiplier` | Cash per unit of quantity × price: `"100"` for a standard option contract, `"0.01"` for a bond quoted per 100 of face. Default `"1"`. Used to check a trade's arithmetic |

Each security needs at least one of `symbol`, `isin`, `cusip` or `name`.

### 4.2 Holdings

What the account held at the end of `asOf`.

| Key | Required | Meaning |
|---|---|---|
| `asOf` | yes | The holdings date |
| `complete` | yes | `true` when `positions` lists **every** holding in the account, so a security missing from it was zero. `false` for a partial view, such as one page or "top holdings" |
| `quantities` | no | `settled` or `trade`, when the institution says which. Leave it out when it doesn't |
| `positions[].security` | yes | A key in `securities` |
| `positions[].quantity` | yes | Units held. Negative for a short position |
| `positions[].price` | no | Price per unit, in the position's currency |
| `positions[].marketValue` | no | Value of the position, in the position's currency |
| `positions[].costBasis` | no | Total cost basis, in the position's currency |
| `positions[].acquiredOn` | no | For a lot: when it was bought. Several positions in one security with `acquiredOn` are kept as separate lots |
| `positions[].currency` | no | Defaults to `account.currency`, and Talia takes that as stated: a US fund a Canadian broker reports in CAD needs no `currency` |
| `cash` | no | Cash by currency: `[{ "currency", "amount" }]`. **Present** means this is all the cash, and `[]` means there is none. **Leave the key out** when you can't see the cash; Talia then asks the user. A money-market fund is a position, not cash |
| `total` | no | The account's total value as the institution states it, in `account.currency`. Talia checks positions plus cash against it |
| `totals` | no | For an account holding several currencies, the institution's total for each currency section: `[{ "currency": "CAD", "amount": "77372.37" }, { "currency": "USD", "amount": "100326.66" }]`, one per currency. Each covers the positions and cash in its currency. Give it alongside or instead of `total`, when the statement shows a total per currency |

Talia checks each position's `quantity × price` against `marketValue` (within the
price's rounding; not for bonds, options and GICs, whose value isn't quantity × price),
positions plus cash against `total`, and each currency's positions plus cash against its
entry in `totals`. A position whose `quantity × price` misses but whose value makes its
currency's total exact is accepted, with the value per unit as its price: the statement's
printed price is the less precise figure. Give the figures the institution shows. Don't
compute missing ones, because then they check nothing.

### 4.3 Activity

What happened during `period`. One entry per event: a single dividend, trade, transfer
or fee.

| Key | Required | Meaning |
|---|---|---|
| `kind` | yes | One of the kinds below |
| `date` | yes | The trade date, or the date it happened |
| `settles` | no | The settlement date, when shown |
| `id` | no | The institution's own transaction id. **Only one the institution assigned**: Talia treats a matching id in a later file as the same event, so an id you make up that changes between runs creates duplicates, and one that repeats merges different events. Unique within the file |
| `ref` | no | A name for this entry within the file, for `reinvests` to point at when the entry has no `id`. Never stored. `id`s and `ref`s must all be different |
| `description` | no | As the institution prints it |
| `security` | by kind | A key in `securities` |
| `quantity` | by kind | Units, as a **positive** magnitude: the kind gives the direction. A corporate action's is the signed change |
| `price` | no | Per unit, in `currency` |
| `amount` | by kind | Net cash of the event: what actually moved in or out of cash, after fees and withholding. Signed, holder's side |
| `fees` | no | Commissions and fees, as a positive magnitude, already included in `amount` |
| `withholding` | no | Tax withheld, as a positive magnitude, already included in `amount` |
| `currency` | no | The currency of `amount`, `fees`, `withholding` and `price`. Defaults to `account.currency` |
| `action` | `corporate_action` | `split`, `merger` or `spinoff` |
| `ratio` | no | A corporate action's terms, new : old, as two whole numbers: `["2", "1"]` |
| `from` | no | A spinoff's parent: the key in `securities` of the holding the new one came from |
| `actionDate` | no | Cash in lieu of a fractional unit: the effective date of the corporate action it pays for. The entry then has `amount` (positive) and no `quantity` or `ratio` |

| `kind` | `security` + `quantity` | `amount` | Notes |
|---|---|---|---|
| `buy` | yes | negative | `amount` = −(quantity × price + fees) |
| `sell` | yes | positive | `amount` = quantity × price − fees |
| `dividend`, `interest`, `distribution` | `security` where there is one | positive | `amount` is net of `withholding`: a $100 dividend with $15 withheld is `"amount": "85.00", "withholding": "15.00"`. One exception: the **accrued interest paid** when buying a bond between coupons is `interest` with a negative `amount`, the bond as `security` and the buy's date; Talia links it to that buy |
| `fee` | no | negative | A standalone charge, such as an account fee |
| `tax_withholding` | no | negative | Tax withheld on its own row, not attached to income |
| `transfer_in`, `transfer_out` | no | signed | Cash crossing the account's boundary: a deposit, a withdrawal |
| `in_kind_in`, `in_kind_out` | yes | none | Shares moved from or to another account, with no cash |
| `fx_conversion` | no | none | Uses `legs` instead: `[{ "currency": "CAD", "amount": "-1370.00" }, { "currency": "USD", "amount": "1000.00" }]`, both legs, signed |
| `corporate_action` | yes | none | Splits, mergers and spin-offs. Add `"action": "split"` (or `merger` or `spinoff`), `quantity` as the signed change in units, and `"ratio": ["2", "1"]` (new : old) when shown. A spinoff's row is on the new security, with `from` naming its parent. Talia proposes it and the user confirms it. **Cash in lieu** of a fraction is its own entry: the same `action`, `security` either the security the action is on or the one it created, `actionDate` the action's effective date, a positive `amount` and no `quantity` |
| `other` | where known | where known | Anything you can't place. It is imported for the user to classify, which is better than leaving it out |

**Reinvested dividends** are two entries, as most institutions show them: the dividend,
and a `buy` with `"reinvests"` naming the dividend's `id`, whose `amount` is the
reinvested cash. When the institution gives the dividend no id, give it a `ref` instead
and point `reinvests` at that. Never invent an `id` for this; see `id` above.

Talia checks each event's arithmetic (a buy's `quantity × price` against its `amount`
less fees) and its sign (a buy's `amount` must be negative). An event that doesn't add up
is imported for review, not dropped and not corrected.

### 4.4 Coverage

`coverage` is required with `activity`. It says which kinds of change the file lists
**completely** for `period`, so that Talia can tell "nothing happened" from "the file
doesn't say":

| Key | `true` means the file lists every… |
|---|---|
| `securities` | change in a quantity: buys, sells, reinvestments, in-kind moves, corporate actions |
| `cash` | change in cash of any kind: trades, income, fees, withholding, conversions, transfers |
| `flows` | movement in or out of the account, in cash or in kind |
| `income` | dividend, interest and distribution |

A full transaction history for the period is `true` for all four. A "dividends" page
alone is `{ "securities": false, "cash": false, "flows": false, "income": true }`. Mark
an aspect `false` whenever you aren't sure: a claim the file can't keep makes Talia
reconstruct holdings wrongly, while a missing claim only leaves a gap that another file
can fill. Talia shows these as review's defaults, and the user can still untick any.

---

## 5. When a file is wrong

Talia separates a file it **can't read** from one whose **figures disagree**:

- **Can't read: the import stops.** A malformed or invalid file is rejected before
  anything is shown: unknown keys, a number where a decimal string belongs, an impossible
  date, a `security` that isn't in `securities`, a duplicate `id`, activity dated
  outside `period` (which would contradict `coverage`). The error lists each
  problem with its JSON path, for example
  `activity[3].amount: expected a decimal string like "12.50", got a number`, so an agent
  can fix the file and try again.
- **Figures disagree: the import goes to review.** A closing balance that doesn't
  reconcile, a buy whose arithmetic doesn't close, a position whose value isn't
  quantity × price, a transaction outside `period`. These are what review is for: the
  user sees each one and decides. Talia never adjusts a figure to make it fit.

Importing the same file twice is stopped, as for any statement. Two files that overlap,
such as September and a September–October export, are deduplicated: activity by `id`
where both have one, else by date, kind, security and amount; transactions by date,
amount and description.

---

## 6. Several accounts: a zip

To import many accounts in one go, put their files in a `.zip` and import it from
**Accounts › Import statements**. Each file is still exactly the format above, for one
account; the zip only carries them together, and its **file names** say which account
each one is for.

```
statements-2026-09.zip
├── 6963797.json                  → the account whose number is 6963797, or ends in it
├── 4821-visa.json                → the account whose number ends in 4821
├── 4821-visa-2026-08.json        → the same account, another period
└── 30117755-rrsp.json            → the account whose number ends in 30117755
```

**Naming.** A file name starts with the account's number: at least 4 digits, then
nothing or a `-`, `_`, space or `.` before anything else you want in the name. Only
digits count: write `6963797`, not `696-3797`. Names that don't start that way, and files
that aren't `.json`, are listed as skipped.

**Which number.** The account number the user entered in Talia, on the account's page
(**Add account number**). The user gives it to you; Talia never shows an internal id.
Use the whole number or just its last digits. Talia matches the way it does everywhere
else: two numbers agree when the longer ends with the shorter. So `4821-visa.json`
matches an account whose number is `4500123448214821` or `4821`, and
`4500123448214821.json` matches one stored as `4821`.

| The name's number matches… | What happens |
|---|---|
| exactly one account | The file is imported into that account, with every check §1–§5 describe: account type, currency, validity |
| no account | Skipped: "No account with a number ending in 4821". The user can add the number on the account's page and import the zip again |
| several accounts | Skipped: "4821 matches 2 accounts". Use more of the number |

If the file also states `account.mask`, it must agree with the name's number, or the
file is skipped. That catches a file saved under the wrong name.

**Several files for one account** are imported oldest first, by `period.start` (a
holdings-only file by `holdings.asOf`), each after the one before it is done, so each is
checked against what the earlier ones added. Overlapping files are deduplicated as in §5.

**Limits.** At most 200 files and 100 MB uncompressed. Each file is held to the 10 MB
statement limit. Folders inside the zip are ignored, as are hidden files and macOS
`__MACOSX/` entries; only the file's own name counts, not its folder's.

**What the user sees.** One list: every file, the account it matched, and whether it is
ready. Files that check out with nothing to decide are imported together with one tap.
The rest open the usual review one at a time, and skipped files say why. Each file is
imported on its own, so one file's problem never holds up another account.

---

## 7. Versions

Agents and scripts outside Talia write this format, and the files they wrote last year
must still import. So the format is a public contract, versioned by `format`:
`talia.statement/` and a whole number.

**A released version never changes.** Its keys, their meanings and the checks §1–§6
describe stay exactly as they were released. Because an unknown key is an error, even an
optional addition would make an older Talia reject a newer file with a misleading
"unknown key", so **any** change a file could notice is a new version: a new key or
enum value, a check that refuses what was accepted, a changed meaning or default. Talia
fixing its own reader to match this document, where they disagreed, is not a change to
the format.

**Talia reads every released version, for good.** A file in an older version is read by
that version's rules and brought up to the newest internally, so it imports exactly as it
did when it was written. No version is ever dropped.

**Write the newest version you know.** There is nothing to negotiate: a Talia that reads
your version imports the file, and one that doesn't says so.

| `format` claims | Talia |
|---|---|
| A version it reads | Checks the file against that version's rules |
| A newer whole number | Stops with `unsupported_statement_version`: "Update Talia to import this file", naming the version the file claims and the ones this Talia reads. Nothing is read, since part of a newer file could mean something else |
| Not a whole number (`talia.statement/1.1`, `talia.statement/v1`) | Stops with `invalid_statement_json`: a mistake in the file, not a newer format |

Every rejection of a file that names the format says which version it claims, so whoever
wrote it can tell a file written for a newer Talia from one that breaks its own version's
rules.

**What each version publishes.** Its JSON Schema at
`https://talia.money/schemas/talia.statement/<n>.json`, and test fixtures that every later
Talia must import. Neither is edited once the version is released.

| Version | Released | Changes |
|---|---|---|
| 1 | 2026 | The first version: everything this document describes |
