Bai2

From wikinotes

Bai2 files are a plaintext fileformat sent daily from banks to communicate processed transactions.

Each record begins with a numeric Type-Code, which defines the number/type of comma-separated entries that follow.

Documentation

Bai2 fileformat spec https://quickstream.westpac.com.au/bankrec-docs/statements/bai2/#bai2-statement-format
Bai2 fileformat spec https://www.sepaforcorporates.com/swift-for-corporates/bai2-format-specification/#:~:text=In%20short%2C%20the%20BAI2%20format,widely%20used%20in%20the%20US.
Bai2 EntryCode types https://www.corporatetobank.com/resources/financial-services-file-formats-and-document-standards/bai2/
Bai2 file examples https://github.com/venturehacks/bai2/tree/master/test/data
Bai2 codes https://cashproonline-cdn1.cpoacc.com/cpwportal/cms/public/html/CashProOnline/CPO_Help/Reporting/IRR/PDFs/BAI_Codes.pdf

Example

source: https://www.tdcommercialbanking.com/document/PDF/bai.pdf

01,0004,12345,060321,0829,001,80,1,2/
02,12345,0004,1,060317,,CAD,/
03,10200123456,CAD,040,+000000000000,,,045,+000000000000,,/
88,100,000000000208500,00003,V,060316,,400,000000000208500,00
008,V,060316,/
16,409,000000000002500,V,060316,,,,RETURNED CHEQUE /
16,409,000000000090000,V,060316,,,,RTN-UNKNOWN /
16,409,000000000000500,V,060316,,,,RTD CHQ SERVICE CHRG/
16,108,000000000203500,V,060316,,,,TFR 1020 0345678 /
16,108,000000000002500,V,060316,,,,MACLEOD MALL /
16,108,000000000002500,V,060316,,,,MASCOUCHE QUE /
16,409,000000000020000,V,060316,,,,1000 ISLANDS MALL /
16,409,000000000090000,V,060316,,,,PENHORA MALL /
16,409,000000000002000,V,060316,,,,CAPILANO MALL /
16,409,000000000002500,V,060316,,,,GALERIES LA CAPITALE/
16,409,000000000001000,V,060316,,,,PLAZA ROCK FOREST /
49,+00000000000834000,000000014/
03,10200123456,CAD,040,+000000000000,,,045,+000000000000,,/
88,100,000000000111500,00002,V,060317,,400,000000000111500,00
004,V,060317,/
16,108,000000000011500,V,060317,,,,TFR 1020 0345678 /
16,108,000000000100000,V,060317,,,,MONTREAL /
16,409,000000000100000,V,060317,,,,GRANDFALL NB /
16,409,000000000009000,V,060317,,,,HAMILTON ON /
16,409,000000000002000,V,060317,,,,WOODSTOCK NB /
16,409,000000000000500,V,060317,,,,GALERIES RICHELIEU /
49,+00000000000446000,000000009/
98,+00000000001280000,000000002,000000025/
99,+00000000001280000,000000001,000000027/
  • a single file will only ever contain a single 01(record header) and 99 (file trailer)
  • can contain multiple groups

Entry Types

01 - File Header

02 - Group Header

03 - Account Identifier & Summary Status

16 - Transaction Detail

49 - Account Trailer

88 - Continuation Record

98 - Group Trailer

99 - File Trailer