BAI2 File Format and Structure: A Comprehensive Guide to BAI2 Files
Authored by donkeygames.net, 18/09/2025
Understanding BAI2 Basics
Corporations rely on BAI2 files to consolidate cash positions from multiple banks into a single report. This bai2 file format standardizes electronic delivery of account balances, deposits, and disbursements. Developed by the Bank Administration Institute, BAI2 superseded the original BAI format with enhanced detail for modern treasury operations.
Definition and Purpose
BAI2 serves as a fixed-width, ASCII text file for bank-to-corporate reporting. It captures daily activity including check deposits, electronic credits, and as-of adjustments. Treasury teams use bai2 files to automate reconciliations and monitor liquidity.
BAI vs BAI2
The bai file format, or BAI1, limited records to summary levels. BAI2 introduces granular transaction details via type 16 records. This evolution supports complex portfolios where bai 2 files provide line-item visibility absent in predecessors.
File Characteristics
Each BAI2 record spans exactly 185 characters, padded with spaces. Records begin with a two-digit type code. Files end with totals matching debits and credits for integrity checks.
Overall Structure of BAI2 Files
BAI2 organizes data hierarchically: file header, account groups, individual accounts, and trailers. This mirrors banking hierarchies, grouping related accounts under a single control total.
Hierarchical Organization
Files start with a type 02 header. Optional type 05 group headers segment accounts. Type 03 records identify accounts, followed by details and type 49 totals. Type 98 closes groups, type 99 the file.
Record Types Overview
- 02: File header with receiver and sender IDs
- 03: Account title and currency
- 16: Transaction details
- 88: Continuation for long descriptions
- 49: Account control total
- 98: Group control total
- 99: File control total
Detailed Record Formats
Precision defines BAI2: fields occupy fixed positions regardless of content length. Parsers read by column offsets.
Header Records
Type 02 occupies positions 1-2: "02". Positions 3-12 hold receiver ID, 13-22 sender ID, 23-30 creation date (YYMMDD). Type 05 adds group name in positions 17-32.
Account Records
Type 03 lists account number (10-19), type code (43-44, e.g., 010 for DDA), and balance (45-62). Type 16 details transactions: amount (29-41, right-justified), funds type (20-22), BAI code (13-15).
Trailer Records
Type 49 sums items (3-10) and amount (13-33) for the account. Type 99 receives file totals, verifying no transmission errors.
Key Fields and Codes in BAI2
Standardized codes ensure interoperability across banks. What is a BAI code? These two- or three-digit identifiers classify transactions precisely.
Transaction Type Codes
- 475: Customer check deposits
- 195: Incoming wires
- 685: ACH credits
- 865: Book transfers
Funds Type Codes
- 010: Demand deposit
- 000: Immediate funds
- 001: One-day hold
- 002: Two-day hold
As-of Adjustments
Records flag prior-day corrections via as-of date (positions 42-49 in type 16). Negative amounts reverse entries.
Parsing and Validating BAI2 Files
Effective parsing demands column-accurate extraction and total reconciliations. Mismatches signal data issues.
Common Parsing Challenges
Space padding obscures lengths; trim trailing spaces on amounts. Continuation records split fields across type 88 lines. Validate record counts against trailers.
Tools and Libraries
Python's struct module slices fixed fields. Java String.substring handles offsets. Open-source parsers like pybai2 automate validation.
Validation Rules
Debit totals equal credit totals in type 99. Account numbers unique within groups. Dates sequential.
Practical Examples and Use Cases
Lockbox processors generate BAI2 for remittance data. Treasuries aggregate across custodians.
Sample BAI2 File
02RECEIVER1234567890SENDER987654321020230101
03 1234567890 01000000012345.67
16475 0000012345.67 01020230101
49 00001 0012345.67
99 00001 0012345.67
Interpreting Deposits and Checks
A type 16 with code 475 and funds 010 indicates cleared checks today. Aggregate by funds type for liquidity forecasting.
Frequently Asked Questions
What distinguishes BAI2 from the original BAI format?
BAI1 summarized accounts at group level without transaction details. BAI2 adds type 16 records for individual items, enabling granular reconciliation. Banks adopted BAI2 for its detail in the 1990s.
How do you identify record types in BAI2 files?
Positions 1-2 hold the two-digit code: 02 for headers, 16 for details. Ignore leading spaces. Parsers scan sequentially for hierarchy.
What is a BAI code in the context of BAI2?
BAI codes are three-digit transaction classifiers in type 16 positions 13-15, like 475 for checks. They standardize descriptions across institutions.
Can BAI2 files handle multiple currencies?
Yes, type 03 position 42 specifies ISO currency code. Amounts remain in file's base, with conversions noted separately.
How do you handle continuation records?
Type 88 follows type 16, appending text to position 16-185. Concatenate across records for full reference data.
Are BAI2 files encrypted or compressed?
No, they transmit as plain ASCII text via SFTP or SWIFT. Security relies on transport protocols, not file format.