A Python library and API for encoding and decoding IATA Bar Coded Boarding Pass (BCBP) data, compliant with the current version of IATA Resolution 792. This API is used by this service hosted at jqs.app/iata.
Tip
This library is designed to be backwards compatible with older versions of the specification. If you notice a discrepancy or would like to propose a fix, please feel free to submit a pull request. For specification updates or boarding passes that cannot be decoded, please contact the author via the git commit email.
# %pip install iata
from iata.bcbp import BarcodedBoardingPass, BoardingPassMetaData, BoardingPassData, Leg, decode, encode
from datetime import datetime, timezone
reference_year = 1970 # Example from BCBP Implementation Guide (Version 8)
boarding_pass = BarcodedBoardingPass( meta=BoardingPassMetaData( version_number=2, ), data=BoardingPassData( passenger_name="DESMARAIS/LUC", legs=[ Leg( operating_carrier_pnr_code="ABC123", from_city_airport_code="YUL", to_city_airport_code="FRA", operating_carrier_designator="AC", flight_number="834", date_of_flight=datetime(reference_year, 8, 14, tzinfo=timezone.utc), compartment_code="F", seat_number="1A", check_in_sequence_number="25", passenger_status="1", ) ], security_data="GIWVC5EH7JNT684FVNJ91W2QA4DVN5J8K4F0L0GEQ3DF5TGBN8709HKT5D3DW3GBHFCVHMY7J5T6HFR41W2QA4DVN5J8K4F0L0GE" )
)
encoded = encode(boarding_pass)
assert encoded == "M1DESMARAIS/LUC EABC123 YULFRAAC 0834 226F001A0025 100^164GIWVC5EH7JNT684FVNJ91W2QA4DVN5J8K4F0L0GEQ3DF5TGBN8709HKT5D3DW3GBHFCVHMY7J5T6HFR41W2QA4DVN5J8K4F0L0GE"
decoded = decode(encoded, reference_year=reference_year)pip install -r requirements.txt
python main.pyAccess API routes at http://0.0.0.0:8000/iata/api/{encode,decode}.
All field names are consistent with those defined in the BCBP Implementation Guide. Fields can either be mandatory (M) or conditional (C).
| Field | Type | M,C | Values |
|---|---|---|---|
version_number |
int | C | 1–9 |
format_code |
str | M | M multiple |
number_of_legs_encoded |
int | M | 1–4 |
electronic_ticket_indicator |
str | M | E electronic ticket L ticketless |
beginning_of_version_number |
str | C | > |
beginning_of_security_data |
str | C | ^ |
| Field | Type | M,C | Values |
|---|---|---|---|
passenger_name |
str | M | [surname]/[given_name] |
passenger_description |
str | C | 0 adult 1 male 2 female 3 child 4 infant 5 no passenger (cabin baggage) 6 adult traveling with infant 7 unaccompanied minor 8 undisclosed 9 unspecified A-Z future industry use |
source_of_check_in |
str | C | W web K airport kiosk R remote or off-site kiosk M mobile device O airport agent T town agent V third party vendor A automated check-in |
source_of_boarding_pass_issuance |
str | C | W web printed K airport kiosk printed X transfer kiosk printed R remote or off-site kiosk printed M mobile device printed O airport agent printed |
date_of_issue_of_boarding_pass |
datetime | C | [julian_date] (YDDD) |
document_type |
str | C | B boarding pass I itinerary receipt |
airline_designator_of_boarding_pass_issuer |
str | C | [airline_code] |
baggage_tag_licence_plate_number |
str | C | [0-9][carrier_code][serial_number][consecutive_number] |
first_non_consecutive_baggage_tag_licence_plate_number |
str | C | [0-9][carrier_code][serial_number][consecutive_number] |
second_non_consecutive_baggage_tag_licence_plate_number |
str | C | [0-9][carrier_code][serial_number][consecutive_number] |
type_of_security_data |
str | C | 1 |
security_data |
str | C | [digital_signature] |
legs |
list | M |
| Field | Type | M,C | Values |
|---|---|---|---|
operating_carrier_pnr_code |
str | M | [record_locator] |
from_city_airport_code |
str | M | [airport_code] |
to_city_airport_code |
str | M | [airport_code] |
operating_carrier_designator |
str | M | [airline_code] |
flight_number |
str | M | |
date_of_flight |
datetime | M | [julian_date] (DDD) |
compartment_code |
str | M | R supersonic P first class premium F first class A first class discounted J business class premium C business class D, I, Z business class discounted W economy/coach premium S, Y economy/coach B economy/coach discounted H, K, L, M, N, Q, T, V, X economy/coach discounted |
seat_number |
str | M | [seat_number] INF infant |
check_in_sequence_number |
str | M | |
passenger_status |
str | M | 0 ticket issuance/passenger not checked in 1 ticket issuance/passenger checked in 2 baggage checked/passenger not checked in 3 baggage checked/passenger checked in 4 passenger passed security check 5 passenger passed gate exit (coupon used) 6 transit 7 standby (seat number to be printed) 8 boarding data validation done 9 original boarding line used at time of ticket issuance A up- or down-grading required at close out B-Z reserved for future industry use |
airline_numeric_code |
str | C | [carrier_code] |
document_form_serial_number |
str | C | [airline_code][form_code][serial_number] |
selectee_indicator |
str | C | 0 not selectee 1 selectee 3 known passenger |
international_documentation_verification |
str | C | 0 verification not required 1 verification required 2 verification performed |
marketing_carrier_designator |
str | C | [airline_code] |
frequent_flyer_airline_designator |
str | C | [airline_code] |
frequent_flyer_number |
str | C | |
id_ad_indicator |
str | C | 0 industry discount network positive space 1 industry discount network space available 2 industry discount benefit positive space 3 industry discount benefit space available 4 agent discount 5 discount government 6 discount military 7 global employee 8 international government 9 registration group A user discount B industry discount no classification C industry discount frequent search positive space D industry discount frequent search space available E industry discount reduced positive space F industry discount reduced space available G-Z for future industry use |
free_baggage_allowance |
str | C | [0-9][0-9][K] kilograms [0-9][0-9][L] pounds [0-9][PC] number of pieces |
fast_track |
bool | C | Y yes N no [ ] unqualified |
for_individual_airline_use |
str | C |
- IATA Resolution 722: Ticket
- IATA Resolution 728: Code Designators for Passenger Ticket
- IATA Resolution 792: Bar Coded Boarding Pass (BCBP)
- IATA Resolution 1788: Ticketing and Baggage Regulations for Free and Reduced Transportation