KibiPay
HomeBlog › Legacy Protocols

BAI2 Bank Statement Format

6 min read Legacy Protocols
BAI2Cash managementLegacy protocols
BAI2 Bank Statement Format

If you have ever automated bank reconciliation or corporate cash management in the United States, you have likely met BAI2. Developed by the Bank Administration Institute, it is a compact, fixed-structure text format for reporting balances and transactions from a bank to its corporate customers. It is old, unglamorous, and still ubiquitous. This post explains how to read one.

What BAI2 is for

BAI2 answers a specific question a corporate treasurer asks every morning: what were my balances and what moved across my accounts yesterday? It is a reporting format, not a payment-initiation format. A bank generates a BAI2 file summarising opening and closing balances, available funds, and each transaction, and the customer's treasury or ERP system ingests it to reconcile and forecast cash.

The record hierarchy

A BAI2 file is a nested structure of records, each identified by a two-digit record type code in the first field. The hierarchy is: file, then one or more groups, then accounts within a group, then transactions within an account.

Every level opens with a header and closes with a trailer that carries a control total. Those trailers are your integrity check: if the totals do not tie out, the file is suspect.

Type codes: the heart of the format

The real meaning in BAI2 lives in its numeric type codes (sometimes called BAI codes). Each summary and transaction record carries a three-digit code that classifies what the amount represents. Some codes describe status/balance items on the 03 record, for example opening ledger balance, closing ledger balance, and closing available balance. Others describe transaction items on the 16 record, distinguishing, say, an incoming wire, an ACH credit, a lockbox deposit, a check paid, or a fee. A parser must map these codes to meaning; the number is authoritative, the accompanying text is not.

Reading a file in practice

To parse BAI2 reliably:

Where BAI2 fits today

BAI2 coexists with newer standards. Internationally, the ISO 20022 camt.053 (bank-to-customer statement) and camt.052 (intraday report) are the modern equivalents, offering richer, structured XML. Many banks provide both, and treasury systems often ingest BAI2 for domestic US reporting while moving to camt messages for cross-border and structured needs. Understanding BAI2 remains valuable precisely because so much existing tooling and so many bank feeds still emit it.

Common parsing gotchas

Real-world BAI2 files are less tidy than the specification suggests, and a few issues catch out first-time integrators. Bank text and reference data on 16 records can contain the field-delimiter character, so naive splitting on commas breaks; robust parsers respect quoting and known field counts. Amounts are usually expressed in the currency's minor units (for example cents), so a value must be scaled, not read as whole currency units. Type-code coverage varies between banks, meaning the same economic event can arrive under slightly different codes from different institutions, which is why a good implementation maintains a per-bank mapping rather than assuming one universal code set. Finally, always reconcile against the trailer control totals before trusting the parsed data; a silently truncated file is worse than an obviously broken one.

Key takeaways

See these rails in motion

KibiPay connects UK Faster Payments, Bacs, CHAPS, Mojaloop mobile money and Solana behind one API, with ISO 20022 messaging and real-time fraud & AML screening.

Open the live console How it works