Accounts and periods
One file 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 that returns openingBalance and closingBalance. Every account is checked against the balances printed in its own section, and verification.issues names the account that does not reconcile.
Periods#
The document has a period, and so does each account. On a file holding several monthly statements for one account, one entry can hold every month's rows, and its period is the first month. months on the account gives money in and out per calendar month; read each transaction's date for the rest. 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.