banking.import_statement
Import one bank account's statement as CSV text (CSV today, PDF later) so the forecast starts from the bank's own balance. Owner or admin only. Stores each line and each day's closing balance for the account named by bank_label, account_last4 and currency; uploading the same statement again adds nothing. Name an account the same way every time (the label is matched ignoring case). Before anything is stored, only the last 4 digits of the account number are kept, and runs of 6 or more digits, email addresses and phone numbers are cut from descriptions and counterparties; payee and payer names stay as the statement gives them until the workspace is closed, when they are emptied and the lines are kept as figures and dates. The columns are recognised from the header (date, balance, and one signed amount or separate withdrawal and deposit columns); no bank layout is verified yet, so check the mapping in the reply. The latest balance, if under 31 days old, becomes the forecast's starting cash, graded 'statement', in place of a typed balance for the same account (a typed account whose label ends in other last 4 digits and dated on or after the statement is added to it, and the sum is graded 'declared'; an older one is left out until it is saved again with today's date), and the stored forecast is rerun. Returns counts, statement_balance, the mapping used, balance_checks, and forecast.status with next_step; verify with forecast.read. Refuses with FORBIDDEN SIMPLER_BANKING_ROLE_REFUSED for any other role (ask an owner or admin); VALIDATION_ERROR SIMPLER_BANKING_ACCOUNT_LAST4_INVALID when account_last4 has fewer than 4 digits (send the last 4 as text); VALIDATION_ERROR SIMPLER_BANKING_STATEMENT_FIELDS_INVALID naming each bad field; CONFLICT SIMPLER_BANKING_ACCOUNT_LABEL_CONFLICT with saved_accounts when an account with the same account_last4 and currency is saved under another bank_label, before anything is stored, because one account under two names would count its balance twice (resend with the saved bank_label for that account, or with new_account: true for a different account); VALIDATION_ERROR SIMPLER_BANKING_STATEMENT_UNPARSEABLE with reason and the file's columns when the columns or dates cannot be read (send mapping with 1-based column numbers, or date_order); PAYLOAD_TOO_LARGE SIMPLER_BANKING_STATEMENT_TOO_LARGE over 2,000,000 bytes or 20,000 lines (export a shorter date range); SERVICE_UNAVAILABLE SIMPLER_BANKING_STATEMENT_WRITE_FAIL (retry the same upload).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mapping | No | Optional: 1-based column numbers, sent after a refusal lists the file's columns. Needs date and balance, plus amount (money in positive) or both debit and credit. | |
| csv_text | Yes | The statement exported from online banking as CSV, at most 2,000,000 bytes. A title block above the header row is fine. | |
| currency | Yes | The account's currency. | |
| bank_label | Yes | The bank's name, such as DBS or Maybank. No account number. | |
| date_order | No | Optional: send only when a refusal says every date can be read two ways. day_first reads 03/04/2026 as 3 April. | |
| new_account | No | Optional: send true only after a SIMPLER_BANKING_ACCOUNT_LABEL_CONFLICT refusal, when this statement is from a different account that shares the saved account's last 4 digits and currency. Leave it out otherwise. | |
| account_last4 | Yes | The account number's last 4 digits as text, such as "0123". A longer number is cut to its last 4. |