BAI2 file format
Each line of a BAI2 file is a record, and its first two characters say which kind: 01 opens the file, 16 is a transaction, 99 closes it. BAI2 is a plain-text report of account balances and transactions that a bank gives its business customers. TidyImport opens .bai, .bai2 and .txt files.
Open it as a table: BAI2 to Excel or CSV.
An example file
Our sample bai2-sample-single-account.bai: one account, six transactions.
01,000111222,000333444,261023,0200,1,,,2/ 02,000333444,000111222,1,261022,2359,,2/ 03,0012345678,USD,010,15000000,,,015,18197550,,,040,15000000,,,045,18000000,,/ 88,100,3625050,3,,400,427500,3,/ 16,195,2500000,0,WIRE0001,INV-1001,Incoming wire, invoice 1001 / Q3 services 16,165,1000000,1,ACH0042,,ACH credit EXAMPLE PAYROLL REFUND 16,142,125050,,ACH0043,,ACH credit received, remittance for 88,order 77 and order 78 (two parts) 16,475,350000,,CHK1042,1042,/ 16,451,75000,,ACH0100,,ACH debit, utilities 16,698,2500,,,,Monthly account fee 49,74302650,10/ 98,74302650,1,12/ 99,74302650,1,14/
The records
| Record | Name | Fields, in order |
|---|---|---|
| 01 | File header | sender, receiver, creation date (YYMMDD), time, file ID, record length, block size, version (2) |
| 02 | Group header | ultimate receiver, originator, group status, as-of date, time, currency, date modifier |
| 03 | Account | account number, currency, then repeating: type code, amount, item count, funds type |
| 16 | Transaction | type code, amount, funds type, bank reference, customer reference, text |
| 88 | Continuation | carries on the record before it, with its next field |
| 49 | Account trailer | control total, number of records |
| 98 | Group trailer | control total, number of accounts, number of records |
| 99 | File trailer | control total, number of groups, number of records |
Fields are separated by commas. A slash ends a record that has no text. An empty field is two commas side by side.
The sample, line by line
| Line | Record | What it says |
|---|---|---|
| 1 | 01 | From 000111222 to 000333444, created 23 October 2026 (261023) at 02:00, file 1, version 2. The record length is empty. |
| 2 | 02 | One group. Status 1 (update), as of 22 October 2026 at 23:59. No currency, which means USD. |
| 3 | 03 | Account 0012345678, USD. Four amounts with status codes 010, 015, 040 and 045: 150,000.00, 181,975.50, 150,000.00 and 180,000.00. |
| 4 | 88 | Carries on the 03 record: code 100 with 36,250.50 over 3 items, code 400 with 4,275.00 over 3 items. |
| 5 | 16 | Code 195, 25,000.00, funds type 0, bank reference WIRE0001, customer reference INV-1001, then the text. The text holds commas and a slash, which text may. |
| 6 | 16 | Code 165, 10,000.00, funds type 1. |
| 7 | 16 | Code 142, 1,250.50. The text goes on in the next line. |
| 8 | 88 | The rest of line 7's text: "order 77 and order 78 (two parts)". |
| 9 | 16 | Code 475, 3,500.00, references CHK1042 and 1042. No text, so the line ends in a slash. |
| 10 | 16 | Code 451, 750.00. |
| 11 | 16 | Code 698, 25.00. No references. |
| 12 | 49 | Account total 743,026.50 over 10 records. |
| 13 | 98 | Group total 743,026.50, 1 account, 12 records. |
| 14 | 99 | File total 743,026.50, 1 group, 14 records. |
Amounts have no decimal point
2500000 in line 5 is 25,000.00. The currency says how many decimals are meant: for USD, two. Detail amounts carry no sign. Whether money came in or went out is in the type code, by range:
| Type codes | Class |
|---|---|
| 001 to 099 | account status (03 records only) |
| 100 to 399 | credits (100 is the first code of the range) |
| 400 to 699 | debits (400 is the first code of the range) |
| 700 to 799 | loans |
| 890 | neither a credit nor a debit (used in 16 records) |
| 900 to 999 | customised: agreed between the two parties, not uniform codes |
In the sample, 142, 165 and 195 are credits and 451, 475 and 698 are debits.
The totals
In the sample the 49 record totals every amount in the account: the four in the 03 record, the two in the 88 record and the six in the 16 records, each as written. Item counts are not amounts.
66,197,550 + 4,052,550 + 4,052,550 = 74,302,650 in the file's units, which is 743,026.50. The 49 counts the 03, the 88 records, the 16 records and itself: 1 + 2 + 6 + 1 = 10. The 98 counts from the 02 to itself: 12. The 99 counts every record: 14.
Banks may total in other ways. A difference is a reason to look, not a finding about the bank.
Length and years
The first sample has records of different lengths. bai2-sample-fixed-length.bai pads every record with blanks to 80 characters and writes 80 in the 01 record's record-length field. The blanks are not part of the record.
The year has two digits. 26 reads as 2026 either way, but a year from 70 to 99 could be in the 1900s or the 2000s, so TidyImport asks. It also takes each currency's decimals from the ISO 4217 list and asks when a currency is not on it. Banks differ in detail: try the file your bank gives you.
Beside MT940 and camt.053
The same job in other formats: MT940 format and CAMT.053 format.
Open a BAI2 file as a table
BAI2 to Excel or CSV shows the transactions, balances, accounts and groups as sheets. Nothing is uploaded.
BAI2 is the file format of the Cash Management Balance Reporting Specifications (BAI; now ASC X9).