Accounts and periods
One PDF can hold several accounts and several months. Iterate accounts rather than reading accounts[0].
Accounts#
accounts holds one entry per account printed on the document, each with its own rows, totals and identity. Usually there is one. Capital One prints a checking account and three savings accounts.
"accounts": [ { "type": "bank", "last4": "8821", "name": null, "primary": true, "openingBalance": 1204.11, "closingBalance": 1602.56, "totals": { "credits": 3240.00, "debits": 2841.55 }, "transactions": [ ... ] }, { "type": "bank", "last4": "4410", "name": "360 Performance Savings", "primary": false, "openingBalance": null, "closingBalance": null, "totals": { "credits": 500.00, "debits": 0 }, "transactions": [ ... ] } ]
The primary account#
Exactly one entry has primary: true: the account the issuer printed first. It is the only account carrying openingBalance and closingBalance, which the statement prints once for the document rather than per account.
Periods#
The document has a period, and so does each account. They match except on a combined PDF that repeats one account across several months, where each entry carries the month it covers. month is 1-12.
A statement straddling a month boundary, as most card statements do, is reported under the month the issuer bills it as. That is the month printed on the document.
Matching an account to your records#
| Field | Use it for | Null when |
|---|---|---|
last4 | Matching a document to an application or an account on file. | The issuer printed no account or card number. |
name | Telling savings sub-accounts apart on a multi-account statement. | The issuer printed the product name at the top of the page rather than against the account. |
type | Deciding whether credits can be income. See Amounts and directions. | Never. It is always bank or credit_card. |
bank covers every deposit account: current, checking and savings.