Guide · Node.js · SDK · REST API

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.

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).

ℹ️The airline code portion is a 2-character IATA designator that can contain letters and digits (e.g. AA, LH, 2G, U2). Do not confuse it with the 3-letter ICAO airline code (e.g. AAL for American Airlines).

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.

PartFormatExampleDescription
Airline code2 charactersAAIATA 2-character airline designator (letters or digits)
Flight number1-4 digits100Numeric portion identifying the specific service
Suffix0-1 letterBOptional letter suffix for operational variants

Combined, a flight number like LH438B breaks down as: airline code LH (Lufthansa), flight number 438, suffix B.

The IsValid API parses the flight number for you and returns each component separately — no need to write your own regex or parsing logic.

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.

Format validation
Checks airline code + 1-4 digit number + optional suffix
Component parsing
Splits into airlineCode, flightNumber, and suffix
Airline lookup
Resolves airline name, country, and ICAO callsign
Single request
Validate, parse, and enrich in one API call

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}`);
}
If you are validating flight numbers from user input in a search form, debounce the API call by 300-500ms to avoid unnecessary requests while the user is still typing.

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
}
FieldTypeDescription
validbooleanWhether the input matches a valid IATA flight number format
airlineCodestring2-character IATA airline designator
flightNumbernumberNumeric portion of the flight number (1-4 digits)
suffixstring | nullOptional single-letter suffix, or null if not present
airlineNamestring | nullFull airline name, or null if the airline code is not recognised
countryCodestring | nullISO 3166-1 alpha-2 country code of the airline's registration
countryNamestring | nullFull English country name of the airline's registration
callsignstring | nullICAO radiotelephony callsign (e.g. AMERICAN)
icaostring | null3-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

Validate the flight number format — airline code + 1-4 digits + optional suffix
Use the parsed fields (airlineCode, flightNumber, suffix) for indexing and lookups
Enrich with airline name, ICAO code, and callsign in the same request
Handle codeshare flights — the same physical flight can have multiple designators
Normalise leading zeros — the API returns the integer flight number
Accept any case — the API normalises to uppercase automatically

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.