Skip to main content

TicketBAI & Factura-e Code Generator (Basque Country / Spain)

Generate TicketBAI (TBAI) identifier codes, hash chaining, and QR Code URLs for Basque Tax Authorities (Araba, Bizkaia, Gipuzkoa).

Waiting for generation...

About the TicketBAI System (Spain)

TicketBAI is the mandatory anti-fraud tax compliance system instituted by the Basque Government and Provincial Treasuries of Araba, Bizkaia (Batuz), and Gipuzkoa.

Each invoice generates a digitally signed XML chained to the preceding invoice, a unique 37-character TBAI code, and a verification QR Code.

Anatomy & Structure of TicketBAI Code (Basque Country)

The TicketBAI (TBAI) identifier consists of 5 regulatory alphanumeric segments established by Basque tax authorities:

PositionFieldLengthRegulatory MeaningExample
Block 1Prefix4 lettersMandatory regulatory prefix 'TBAI'.TBAI
Block 2Issuer NIF9 charsTax identification number with provincial code (48=Bizkaia, 20=Gipuzkoa, 01=Álava).B48159227
Block 3Issue Date6 digitsInvoice date in DDMMYY format.240826
Block 4CRC Signature8 hex charsFirst 8 hex characters of the certified electronic signature.D156961E
Block 5Check Digits2 digitsModulo 97 checksum over the ASCII representation of the signature.65

TicketBAI Check Digit Calculation Algorithm (Modulo 97)

The 2-digit control segment validates the integrity of the invoice signature:

CheckDigit = (Σ ASCII(CRC8[i])) % 97
  1. 1. Signature Extraction: isolate the 8 hexadecimal characters of the signature segment.
  2. 2. ASCII Byte Sum: sum the ASCII code point values of all 8 characters.
  3. 3. Modulo 97: divide the sum by 97 to obtain the remainder.
  4. 4. Two-Digit Formatting: format the remainder with a leading zero (00 to 96) to produce the control digit.

Frequently Asked Questions (FAQ)