IATA Flight Number Validation in Node.js — Airline Lookup & Parsing
Flight numbers like AA100 or LH438B appear in booking confirmations, airport displays, and flight-tracking APIs. Learn how to validate, parse, and enrich them in a single call.
In this guide
1. What is an IATA flight number?
An IATA flight number (also called a flight designator) is a code assigned to a scheduled airline service. It consists of a 2-character airline code followed by a 1- to 4-digit number and an optional single-letter suffix. These identifiers appear on boarding passes, airport departure boards, flight-tracking apps, and GDS booking systems.
Some well-known examples: AA100 (American Airlines), LH438 (Lufthansa), BA15 (British Airways), EK1 (Emirates).
2. Structure breakdown
An IATA flight number has three parts. Understanding this structure helps when parsing user input, validating API payloads, or building flight search interfaces.
| Part | Format | Example | Description |
|---|---|---|---|
| Airline code | 2 characters | AA | IATA 2-character airline designator (letters or digits) |
| Flight number | 1-4 digits | 100 | Numeric portion identifying the specific service |
| Suffix | 0-1 letter | B | Optional letter suffix for operational variants |
Combined, a flight number like LH438B breaks down as: airline code LH (Lufthansa), flight number 438, suffix B.
3. Why flight number validation matters
Booking systems
Users enter flight numbers when booking ancillary services (lounge access, parking, transfers). A malformed flight number causes downstream lookup failures. Validating the format at input time prevents errors before they propagate through the system.
Flight tracking
Flight-tracking applications query external APIs (FlightAware, AviationStack, Cirium) using flight numbers. Sending an invalid flight number wastes API quota and returns empty results. Validating and parsing the input first saves round-trips.
API and data pipeline integrity
ETL pipelines and data warehouses that ingest flight data need to normalise and validate flight numbers at ingestion time. Splitting the airline code, numeric part, and suffix enables proper indexing, deduplication, and join operations.
4. The right solution: one API call
The IsValid IATA Flight API validates the flight number format, parses it into its component parts, and enriches it with airline metadata — airline name, country, ICAO callsign, and more — all from a single GET request.
Get your free API key at isvalid.dev — 100 calls per day, no credit card required.
Full parameter reference and response schema: IATA Flight Validation API docs →
5. Node.js code example
Using the @isvalid-dev/sdk package or the native fetch API (Node 18+).
// flightValidator.js import { createClient } from '@isvalid-dev/sdk'; const iv = createClient({ apiKey: process.env.ISVALID_API_KEY }); // ── Example usage ──────────────────────────────────────────────────────────── const result = await iv.iata.flight('AA100'); console.log(result.valid); // true console.log(result.airlineCode); // 'AA' console.log(result.flightNumber); // 100 console.log(result.airlineName); // 'American Airlines' console.log(result.suffix); // null if (result.valid) { console.log(`Flight ${result.airlineCode}${result.flightNumber} — ${result.airlineName}`); // → Flight AA100 — American Airlines }
For batch validation — processing a list of flight numbers from a schedule or import file:
// flightBatch.js — validate multiple flight numbers sequentially async function validateFlights(flightList) { const results = []; for (const flight of flightList) { try { const data = await validateFlight(flight); results.push({ flight, ...data }); } catch (err) { results.push({ flight, valid: false, error: err.message }); } } return results; } // ── Example ────────────────────────────────────────────────────────────────── const flights = ['AA100', 'LH438B', 'BA15', 'INVALID', '123']; const results = await validateFlights(flights); for (const r of results) { const status = r.valid ? '✓' : '✗'; const airline = r.airlineName ?? 'unknown'; console.log(` ${status} ${r.flight.padEnd(10)} ${airline}`); }
6. cURL example
American Airlines flight 100:
curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://api.isvalid.dev/v0/iata/flight?value=AA100"
Lufthansa flight with suffix:
curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://api.isvalid.dev/v0/iata/flight?value=LH438B"
Invalid format:
curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://api.isvalid.dev/v0/iata/flight?value=INVALID"
7. Understanding the response
Response for AA100 (American Airlines):
{ "valid": true, "airlineCode": "AA", "flightNumber": 100, "suffix": null, "airlineName": "American Airlines", "countryCode": "US", "countryName": "United States", "callsign": "AMERICAN", "icao": "AAL" }
Response for an invalid flight number:
{ "valid": false }
| Field | Type | Description |
|---|---|---|
| valid | boolean | Whether the input matches a valid IATA flight number format |
| airlineCode | string | 2-character IATA airline designator |
| flightNumber | number | Numeric portion of the flight number (1-4 digits) |
| suffix | string | null | Optional single-letter suffix, or null if not present |
| airlineName | string | null | Full airline name, or null if the airline code is not recognised |
| countryCode | string | null | ISO 3166-1 alpha-2 country code of the airline's registration |
| countryName | string | null | Full English country name of the airline's registration |
| callsign | string | null | ICAO radiotelephony callsign (e.g. AMERICAN) |
| icao | string | null | 3-letter ICAO airline code (e.g. AAL) |
8. Edge cases to handle
(a) Codeshare flights
A single physical flight can have multiple flight numbers from different airlines. For example, a flight operated by American Airlines as AA100 may also be sold by British Airways as BA1525. Both are syntactically valid IATA flight numbers. The API validates the format and resolves the marketing airline — it does not determine the operating carrier.
// Both codeshare partners have valid flight numbers const marketing = await iv.iata.flight('BA1525'); const operating = await iv.iata.flight('AA100'); console.log(marketing.valid); // true console.log(marketing.airlineName); // 'British Airways' console.log(operating.airlineName); // 'American Airlines'
(b) Suffix letters
Airlines use suffix letters to distinguish operational variants of the same flight number — for example, different days of the week, aircraft substitutions, or diversions. The suffix is always a single letter appended to the numeric part.
const result = await iv.iata.flight('LH438B'); console.log(result.airlineCode); // 'LH' console.log(result.flightNumber); // 438 console.log(result.suffix); // 'B' console.log(result.airlineName); // 'Lufthansa'
(c) Leading zeros
Some systems pad flight numbers with leading zeros (e.g. AA0100 instead of AA100). The API normalises the numeric part, so the flightNumber field always returns the integer value without padding.
const r1 = await iv.iata.flight('AA0100'); const r2 = await iv.iata.flight('AA100'); console.log(r1.flightNumber); // 100 console.log(r2.flightNumber); // 100
(d) Case insensitivity
The API accepts flight numbers in any case — aa100, Aa100, and AA100 all return the same result. The response always returns the normalised uppercase form in the airlineCode field.
const r1 = await iv.iata.flight('aa100'); const r2 = await iv.iata.flight('AA100'); console.log(r1.airlineCode); // 'AA' console.log(r2.airlineCode); // 'AA'
9. Summary
Node.js integration notes
In a TypeScript project, represent a validated IATA flight number as a branded type so the compiler enforces that only checked values flow through your pipeline: type IataFlightNumber = string & { readonly __brand: 'IataFlightNumber' }. The IsValid SDK ships with complete TypeScript definitions for all response fields, which means your editor provides autocomplete on the parsed result — country codes, category names, registry data — without writing manual type declarations.
IATA flight number validation often appears inside data ingestion pipelines: EDI feeds, supply-chain APIs, catalog imports, or financial data streams. In these contexts, validation happens at the boundary where external data enters your system. Model this as a transformation step: raw string in, validated branded type out. Use Promise.allSettled() to process batches and collect both valid and invalid results — invalid items can be quarantined for manual review without blocking the rest of the batch.
Express.js and Fastify middleware
For APIs that accept IATA flight number as a path or query parameter, create a route middleware that validates the value before it reaches the handler. On success, attach the full parsed API response to req.validatedData so handlers can access enrichment fields (description, category, country) without making a second API call. Cache the parsed result in Redis keyed by the normalised identifier to avoid repeat API calls for the same value within a TTL window.
When IATA flight number values arrive from user input or partner systems, normalise them before validation: trim surrounding whitespace, remove optional hyphens or spaces that some sources include for readability, and convert to the canonical case used by the relevant standard. Apply the same normalisation logic consistently across your codebase to prevent cache misses caused by formatting differences rather than value differences.
- Read
process.env.ISVALID_API_KEYonce at startup and store it in a module-level constant - Use
jest.mock()to stub the IsValid client in unit tests; CI pipelines should never make real API calls - Log the full validation response at
debuglevel — it often contains fields useful for debugging data quality issues - For very high throughput, consider a local pre-filter that checks format with a regex before calling the API, reducing calls for obviously malformed inputs
When making HTTP calls to the IsValid API directly (without the SDK), the choice between fetch and axios is largely a matter of preference. The native fetch API is available in Node.js 18+ without any additional dependency and is sufficient for simple request/response flows. axios adds automatic JSON parsing, request/response interceptors, and a cleaner timeout API (axios.create({ timeout: 5000 })), which makes it easier to centralise the Authorization header and retry logic in one place. For high-throughput services that make many concurrent API calls, consider undici — the HTTP client underlying Node.js fetch — used directly for its connection pooling and lower overhead.
See also
Validate IATA flight numbers instantly
Free tier includes 100 API calls per day. No credit card required. Airline name, ICAO code, callsign, and country lookup included in every response.