Retrieve the BAI2 file from your bank's SFTP or file delivery channel; validate the file encoding (ASCII or UTF-8) and the presence of required record types: 01 File Header, 02 Group Header, 03 Account Identifier, 16 Transaction, 49 Account Trailer, 98 Group Trailer, 99 File Trailer
Parse each Account Identifier record (type 03) to extract the bank customer account number, currency code, and as-of date; create or match an internal account record for each
For each Transaction record (type 16), extract the BAI2 type code, amount, funds type, and text description; map the BAI2 type code to your internal transaction category (debit, credit, memo post, etc.)
Validate the Account Trailer (type 49) control totals: sum of credit amounts and debit amounts within each account must match the trailer's control totals; reject the account block if they do not match
Post the validated transactions to your internal cash-position ledger with the BAI2 as-of date as the value date; flag any transaction whose BAI2 type code does not appear in your type-code mapping table for manual review
Run a daily closing balance check: the closing ledger balance for each account must equal the BAI2 account-level closing balance figure; alert on any discrepancy
Known gotchas
BAI2 amounts are unsigned integers in the file — the debit or credit nature is encoded in the BAI2 type code, not a sign character; inverting this logic causes all signs in your ledger to be wrong
Some banks use non-standard BAI2 extensions or append text in the free-form description fields that contains commas, causing naive CSV-style parsers to misalign columns; use the BAI2 comma-delimiter spec precisely and treat quoted fields as a special case
BAI2 files may contain continuation records (type 88) for long description fields; a parser that ignores type 88 records will silently drop part of the transaction description
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp