Establish SFTP connectivity to each bank's delivery server; configure the SFTP client with host-based key verification (store the server public key fingerprint at setup to prevent MITM substitution) and use key-pair authentication rather than password for the SFTP session
Implement format detection logic: read the first bytes of each retrieved file — BAI2 files begin with '01,' as the File Header record type; camt.053 files begin with XML declaration and the BankToCustomerStatementV namespace URI — route each file to the appropriate parser
Parse BAI2 files extracting record type, account number, currency code, BAI balance type codes (009 closing ledger, 015 closing ledger with float, 045 closing available, etc.), and Type-16 transaction records with their three-digit BAI transaction codes; parse camt.053 files extracting Stmt IBAN, Bal elements by type code (OPBD opening booked, CLBD closing booked, ITBD intraday booked), and Ntry elements with BkTxCd Domain/Family/SubFamily classification
Build a normalization mapping table that translates both BAI transaction type codes and camt.053 BkTxCd code triplets to a unified internal transaction category taxonomy; include bank-specific proprietary codes (which appear in BAI Type-16 with a preceding comma or in camt.053 under Prtry) in the mapping to prevent unclassified entries
Upsert normalized transaction records into your TMS using account number and bank-assigned transaction sequence as a composite deduplication key; post normalized balance snapshots tagged with effective date and balance type (ledger vs available vs float) to your cash position store
Generate a daily format health report tracking the percentage of transaction codes successfully mapped vs falling to the unmapped-proprietary bucket; use this report to identify new proprietary codes introduced by bank system upgrades and add them to the mapping table proactively
Known gotchas
Banks sometimes switch between BAI2 and camt.053 delivery for the same account during system upgrades without advance notice; a format detector that caches the expected format per account will silently fail to process statements during the switchover, creating a gap in cash position data
camt.053 files from different banks use different version namespaces even when the content structure is similar; a parser that hardcodes the namespace URI for camt.053.001.002 will fail entirely on a camt.053.001.008 file from a different bank despite the files being structurally compatible
BAI2 Type-88 continuation records are only meaningful when concatenated with the preceding Type-16 record text; an SFTP file chunked across multiple reads where a chunk boundary falls between a Type-16 and its Type-88 continuation will cause the parser to process a truncated record — always read BAI2 files entirely before parsing
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