Free 30-minute AI & automation audit with a senior engineer. You keep the notes. Book yours

Software Development

BAI2 File Format Explained: Records, Type Codes and a Sample File

The BAI2 file format explained record by record: headers, account summaries, transaction detail, continuations, trailers, type codes and a sample BAI2 file.

A BAI2 file is a comma-delimited cash management report that US banks send to their corporate customers. Each record ends with a slash. The file is nested: a file header (01) wraps one or more groups (02), each group wraps accounts (03), each account lists transactions (16), and trailers (49, 98, 99) close each level with control totals and record counts.

This guide is for developers and finance systems teams who need to parse BAI2 files from banks such as Bank of America, JPMorgan Chase or Wells Fargo, map them to an ERP, or fix a parser that keeps misreading them. It walks through each record, the type codes and funds types, a sample file with fake data and the pitfalls that cause most parsing errors.

Bank names are trademarks of their owners. MultiGenesys is not affiliated with these banks; always validate files against your bank’s current specification. Each bank publishes its own BAI2 implementation guide, and where this article says “confirm”, that guide is the authority.

How is a BAI2 file structured?

Every record starts with a two-digit record code. Fields are separated by commas and the record ends with /. The structure looks like this:

01  File Header
  02  Group Header            (one per group)
    03  Account Identifier and Summary   (one per account)
      16  Transaction Detail  (zero or more per account)
      88  Continuation        (continues the previous record)
    49  Account Trailer
  98  Group Trailer
99  File Trailer

A file can contain several groups, and a group can contain many accounts. Amounts have no decimal point. For USD, the last two digits are cents, so 125000 means $1,250.00. An empty field between two commas means the field is defaulted or not provided.

What is in the file header (01)?

Field Notes
Record code 01
Sender identification Identifies the bank or processor sending the file
Receiver identification Identifies you, the file’s recipient
File creation date YYMMDD
File creation time HHMM
File identification number Distinguishes files sent on the same day; useful for duplicate detection
Physical record length Optional; often blank
Block size Optional; often blank
Version number 2 for BAI2

The sender and receiver values are assigned by your bank. Store the file ID number with every file you process so you can reject a file you have already posted.

What is in the group header (02)?

Field Notes
Record code 02
Ultimate receiver identification The party the data is for
Originator identification Usually the bank that holds the accounts
Group status 1 means update
As-of date YYMMDD; the business date the balances and transactions relate to
As-of time HHMM; some banks use 2400 for end of day, so confirm the convention
Currency code Default currency for the group, such as USD
As-of date modifier Optional; indicates the kind of report. Confirm the values with your bank’s BAI2 implementation guide

The as-of date is the one that matters for accounting. The file creation date in the 01 record is usually the following morning for a prior-day file.

What is in the account identifier and summary record (03)?

The 03 record names the account and carries its balances and summary totals.

Field Notes
Record code 03
Customer account number The bank account the following records belong to
Currency code Overrides the group currency if present
Type code, amount, item count, funds type Repeats for each summary or status item

Common status and summary type codes:

Type code Meaning
010 Opening ledger
015 Closing ledger
040 Opening available
045 Closing available
100 Total credits
400 Total debits

Status items such as balances usually leave item count and funds type empty. Summary items such as total credits carry an item count. A long 03 record is often split across 88 continuation records, so never assume all the balances are on one line.

What is in the transaction detail record (16)?

Each 16 record is one transaction.

Field Notes
Record code 16
Type code Three digits; tells you what the transaction is and, for standard codes, its direction
Amount Unsigned, no decimal point
Funds type When the funds are available; some values add extra fields
Bank reference number The bank’s reference for the item
Customer reference number Your reference, such as a check number or payment ID, when the bank has one
Text Free text, such as originator name, remittance or wire details

Standard detail type codes in the range 100–399 are credits and 400–699 are debits. Bank custom codes, usually in the 900–999 range, carry no direction of their own, so you need the bank’s own list for them. Examples:

Type code Meaning Direction
165 Preauthorized ACH credit Credit
195 Incoming money transfer Credit
475 Check paid Debit
495 Outgoing money transfer Debit

Banks also define their own custom codes for products the standard list does not cover. Get the full list from each bank’s implementation guide before go-live.

What do the funds type values mean?

Value Meaning
0 Immediate availability
1 One-day availability
2 Two-or-more-day availability
S Distributed availability
V Value dated
Z Unknown

Some funds types change the field layout. S is followed by availability amounts, and V by a value date and time, so the bank reference no longer sits in a fixed position. Confirm the exact layout for each funds type with your bank’s BAI2 implementation guide.

What is the continuation record (88)?

An 88 record continues the record immediately before it. It carries no new type code; its fields are appended to the previous record. Banks use it when a record is too long for their line length, or to carry extra text such as wire originator details or remittance information.

Your parser should join 88 records to their parent before interpreting any fields. If you parse line by line, a wire’s originator name or invoice reference ends up in a separate row and matching fails.

What is in the trailer records (49, 98, 99)?

Record Fields
49 Account Trailer Account control total, number of records
98 Group Trailer Group control total, number of accounts, number of records
99 File Trailer File control total, number of groups, number of records

In the common convention, the account control total is the sum of the amounts in the account’s 03 and 16 records, and the record count covers every record from the 03 to the 49 inclusive, including 88 continuations. The group control total is the sum of its account control totals, and the group record count runs from the 02 to the 98. The file control total is the sum of the group totals, and the file record count includes every record from 01 to 99. Some banks differ on which records or amounts are included, so confirm with your bank’s BAI2 implementation guide.

What does a sample BAI2 file look like?

Here is a prior-day file with one group and two accounts. Every value is fake: the identifiers, account numbers, references and names are made up for illustration. We generated the control totals and record counts with a script and checked them with a separate parser.

01,EXAMPLEBANK,YOURCOMPANY,261121,0600,001,,,2/
02,YOURCOMPANY,EXAMPLEBANK,1,261120,2400,USD,/
03,0001234567,USD,010,10000000,,,015,11576950,,,040,9500000,,,045,11076950,,,100,2625000,2,,400,1048050,2,/
16,165,125000,0,BR0001,INV-1001,ACH CREDIT TEST CUSTOMER ONE
16,195,2500000,0,BR0002,,INCOMING WIRE TEST CUSTOMER TWO
88,ORIGINATOR TEST CUSTOMER TWO REF PO-7781
16,475,48050,0,BR0003,1045,CHECK PAID
16,495,1000000,0,BR0004,PAY-2026-118,OUTGOING WIRE TEST VENDOR
49,49500000,7/
03,0007654321,USD,010,250000,,,015,310000,,/
16,165,60000,1,BR0005,INV-1002,ACH CREDIT TEST CUSTOMER THREE
49,620000,3/
98,50120000,2,12/
99,50120000,1,14/

Reading it record by record:

  • The file header was created on 261121 at 0600, file ID 001, version 2.
  • The group header has status 1 (update), as-of date 261120, as-of time 2400 and currency USD.
  • The first 03 reports an opening ledger of $100,000.00 and a closing ledger of $115,769.50, available balances, total credits of $26,250.00 across 2 items and total debits of $10,480.50 across 2 items.
  • Four 16 records, whose text fields end at the line break rather than with / (see the pitfalls below): an ACH credit of $1,250.00 (165), an incoming wire of $25,000.00 (195), a paid check of $480.50 (475) and an outgoing wire of $10,000.00 (495). The 88 adds originator text to the incoming wire.
  • The first 49 shows a control total of 49500000 (the six 03 amounts plus the four 16 amounts) and 7 records (03, four 16s, one 88 and the 49).
  • The second account opens at $2,500.00, closes at $3,100.00 and has one ACH credit of $600.00 with one-day availability. Its 49 shows 620000 and 3 records.
  • The 98 shows a group total of 50120000 (49500000 + 620000), 2 accounts and 12 records (02 through 98).
  • The 99 shows the same total, 1 group and 14 records in the file.

The first account also balances: 100,000.00 + 26,250.00 − 10,480.50 = 115,769.50. Checking that opening plus credits minus debits equals closing is a useful extra validation, but intraday and some bank-specific files will not always balance this way.

What are the common BAI2 parsing pitfalls?

Most broken BAI2 parsers fail on the same few things.

  • Continuation records. 88 records can continue a 16, a 03 or other records. Join them to the parent before splitting fields. Watch for a field that is split across the boundary in some banks’ files.
  • Custom type codes. A parser that only knows the standard list will drop or misclassify bank-specific codes. Treat unknown codes as exceptions, not as zero or as a default category. The 100–399 (credit) and 400–699 (debit) ranges only cover standard codes; bank custom codes, usually 900–999, need the bank’s own list to tell you their direction.
  • The trailing slash and comma rules. A / can end a record early, which means every remaining field is defaulted. Empty fields between commas are defaulted values, not zeros. The text field in a 16 record is free text and may contain commas, so take everything after the customer reference as text rather than splitting it. Per the BAI2 specification, a 16 record’s text field is not terminated by /; the record ends at the next record, and a / appears only when the text is empty. Some banks add one anyway, and a / can appear inside text, so confirm in your bank’s BAI2 implementation guide rather than stripping the last character blindly.
  • Totals that include or exclude certain records. Banks do not all compute control totals and record counts the same way. Build the rules for each bank from its guide and test them with real files, rather than hard-coding one convention.
  • Signs and decimals. Detail amounts are unsigned and their direction comes from the type code. Balances in the 03 record can be negative, so handle a leading sign. Do not assume two decimal places for every currency.
  • Funds types that add fields. S and V shift every field after them. Parse by funds type, not by fixed position.
  • Duplicate and late files. Use the file ID, as-of date and account to detect a file you have already posted, and decide how intraday data is replaced by the prior-day file.

Prior-day vs. intraday reporting: what is the difference?

Prior-day reporting covers the previous business day’s final balances and transactions. It is what you reconcile and post to the ledger. Intraday reporting covers activity so far today, often several times a day, and is used for cash positioning and funding decisions. Intraday files are provisional: a transaction can appear in an intraday file and again in the next prior-day file. Keep them in separate stores and reconcile the ledger from prior-day data only.

BAI2 vs. camt.053 vs. MT940: which should you use?

BAI2 camt.053 MT940
Standard body Originally BAI; now maintained by ASC X9 as the Balance and Transaction Reporting Standard (BTRS) ISO 20022 SWIFT
Typical use US banks’ cash management reporting Banks worldwide, SEPA and host-to-host International banks, long-established
Syntax Comma-delimited records ending in / (except where a record ends with text) XML Tagged text fields
Transaction codes Three-digit BAI type codes plus bank custom codes Structured bank transaction codes SWIFT transaction type codes plus bank-specific details
Remittance detail Free text, often split across 88 records Structured fields with room for detailed remittance Limited free text
Intraday reporting Intraday BAI2 files camt.052 is the intraday report MT942 is the intraday report
Parsing effort Moderate; bank variants are the main cost Higher upfront (XML schema), more consistent once built Moderate; field 86 content varies by bank

If your banks are all in the US, BAI2 is often the format they offer first. If you bank across several countries, camt.053 gives you the most structured data, and many banks offer it alongside BAI2 or MT940. In practice you may need all three, so normalize them into one transaction model before matching.

How do you process BAI2 files into an ERP?

A reliable pipeline has five stages:

  1. Collect each file over SFTP or from a treasury portal download, decrypt if the bank uses PGP, and store the original unchanged.
  2. Parse and validate every record, join continuations and check control totals and record counts at each level. Reject the file if they do not agree.
  3. Map each type code to a cash category and general ledger account, and each bank account to its ledger account.
  4. Match detail records to outgoing ACH payments, wires, checks and open invoices using amounts, dates, references and text.
  5. Post matched items to the ERP or accounting system, and send the rest to an exceptions queue for review.

Our BAI2 file processing service builds this pipeline end to end. If you also send payments to US banks, the matching step works best when it knows exactly what you sent, which is where a NACHA file generation integration and BAI2 processing meet.

From our projects

MultiGenesys has built bank-file integrations for finance products, including ABA (Australian Direct Entry) file generation for a Salesforce-native accounting product and scheduled bank-feed services for the same product family. Our in-house product works the same way: FinAIQ Payment Files generates ABA, NACHA, ISO 20022 pain.001 and bank CSV files from Salesforce (as a managed package), ERPs, accounting systems or custom applications, and reads acknowledgements, pain.002 and BAI2, camt.053 and MT940 statements back. Reading BAI2 back means payments are confirmed against what cleared at the bank. The parsing rules and pitfalls in this article come from that work and from building bank statement sync pipelines for camt.053, MT940 and BAI2.

If you need BAI2 files parsed, matched and posted to your ERP, see our BAI2 file processing service or FinAIQ Payment Files. For outgoing US payments, see NACHA file format explained, and for all formats, bank payment files. US teams can also read about our software development work in the USA. If you want a second pair of eyes on your bank’s BAI2 guide or a parser that keeps failing, Book a 30-min call.

FAQ

What does BAI2 stand for?

BAI2 is version 2 of the cash management balance reporting format published by the Bank Administration Institute. The standard is now maintained by ASC X9 as the Balance and Transaction Reporting Standard (BTRS). The version number appears as 2 in the last field of the 01 file header.

What do the record codes in a BAI2 file mean?

01 is the file header, 02 the group header, 03 the account identifier and summary, 16 a transaction detail, 88 a continuation, 49 the account trailer, 98 the group trailer and 99 the file trailer.

How do I tell credits from debits in a BAI2 file?

Use the type code. Standard detail codes 100–399 are credits and 400–699 are debits; bank custom codes (usually 900–999) need the bank’s own list. Amounts in 16 records are unsigned, so the type code is the only reliable indicator of direction.

Why does my BAI2 control total not match?

The usual causes are continuation records that were not counted, custom type codes that were skipped, negative balances read as positive, or a bank that includes or excludes certain records differently from your parser. Compare your rules with your bank’s BAI2 implementation guide.

Is BAI2 being replaced by ISO 20022 camt.053?

Many banks now offer camt.053 alongside BAI2, and multi-bank treasury teams often prefer its structured data. BAI2 is still widely offered by US banks, so most finance systems serving US companies need to support it. Ask your banks which formats they offer and plan for both.

Newsletter

Get the MultiGenesys newsletter

Practical notes on AI, software engineering and automation from our engineers. One email a month, no spam, unsubscribe anytime.

By subscribing you agree to receive our newsletter. Unsubscribe anytime. See our privacy policy.

Free AI audit Book a call