Cathay Pacific (LAX) Flights API
You need to surface Cathay Pacific (IATA: CX) flights touching Los Angeles International Airport (LAX) with reliable status, times, terminals, gates, and codeshares—without reverse engineering airline sites. By the end of this guide, you’ll query FlightLabs for CX schedules around LAX, understand how to monitor real-time status, and wire that data into a status page, an airport dashboard, or a logistics workflow.
Context: Cathay Pacific data around LAX
Cathay Pacific Airways (IATA: CX) is based in Hong Kong and operates long-haul international routes. LAX (IATA: LAX) is a major U.S. gateway with multiple terminals and high long-haul volume. In this article we’ll anchor queries specifically to CX flights that depart from or arrive at LAX and compare the best FlightLabs endpoints for this use case.
Choosing the right FlightLabs endpoints for CX at LAX
FlightLabs exposes several categories of endpoints that are relevant to CX flights at LAX. Each solves a different problem and returns a different level of detail:
- Flight Schedules: plan windows of expected CX arrivals and departures at LAX, including terminals, scheduled times, and aircraft references.
- Real-time Flight Tracking: current flight status and position data when a flight is en route, including gates and updated ETAs.
- Flight History: past operations, useful for analytics or backfilling status timelines.
- Future Flights: upcoming planned flights beyond the immediate schedule window.
- Flight Info by Flight Number: look up a specific CX flight to enrich a detail page.
We’ll rely on schedules for the initial list of CX flights and then augment with real-time status to power a production-grade LAX board for Cathay Pacific operations.
Quick start: CX departures from LAX via Flight Schedules
Use the schedules endpoint to collect a structured list of LAX flights, then filter to the airline IATA code CX in your application. The schedule response provides consistent timestamps in UTC (Z-suffix), terminal metadata, and airline identifiers.
cURL: query LAX departures
curl -s "https://api.goflightlabs.com/flights-schedules?iataCode=LAX&type=departure&api_key=YOUR_API_KEY"
Notes:
- iataCode=LAX anchors the results to Los Angeles International Airport.
- type=departure returns outbound flights from LAX; use type=arrival for inbound flights.
- Filter for airline.iata === "CX" in code to isolate Cathay Pacific flights.
Sample response structure to expect
While this example is not specific to CX, the field structure is representative of the schedules payload you will parse for Cathay Pacific flights at LAX:
{
"success": true,
"data": {
"schedules": [
{
"flight_number": "UA456",
"departure": {
"airport": "SFO",
"scheduled": "2024-03-20T08:00:00Z",
"terminal": "3"
},
"arrival": {
"airport": "ORD",
"scheduled": "2024-03-20T14:15:00Z",
"terminal": "1"
},
"aircraft": {
"type": "Boeing 787-9",
"registration": "N123UA"
},
"airline": {
"name": "United Airlines",
"iata": "UA"
}
}
]
}
}
Fields you’ll rely on for CX at LAX:
- airline.iata: filter for "CX".
- flight_number: CX flight number for user display and internal joins.
- departure.airport / arrival.airport: use "LAX" to confirm direction (departures vs arrivals).
- departure.scheduled / arrival.scheduled: UTC times; convert to local time zones for display.
- departure.terminal / arrival.terminal: passenger-facing terminal info on the board.
- aircraft.type and aircraft.registration: optional enrichment for aircraft details on CX routes.
JavaScript example: filter for CX at LAX
async function getCathayDeparturesFromLAX() {
const url = "https://api.goflightlabs.com/flights-schedules?iataCode=LAX&type=departure&api_key=YOUR_API_KEY";
const res = await fetch(url);
if (!res.ok) {
throw new Error(`HTTP ${res.status}`);
}
const json = await res.json();
// Guard if structure changes or is empty
const schedules = (json && json.data && Array.isArray(json.data.schedules))
? json.data.schedules
: [];
// Filter for Cathay Pacific (IATA: CX)
const cxDepartures = schedules.filter(s => s.airline && s.airline.iata === "CX");
// Normalize for display (convert times, handle missing terminals)
return cxDepartures.map(s => ({
flightNumber: `CX${s.flight_number}`,
depAirport: s.departure && s.departure.airport,
depScheduledUtc: s.departure && s.departure.scheduled, // Convert to local as needed
depTerminal: s.departure && s.departure.terminal || null,
arrAirport: s.arrival && s.arrival.airport,
arrScheduledUtc: s.arrival && s.arrival.scheduled,
arrTerminal: s.arrival && s.arrival.terminal || null,
aircraftType: s.aircraft && s.aircraft.type || null,
registration: s.aircraft && s.aircraft.registration || null
}));
}
// Example usage
getCathayDeparturesFromLAX()
.then(list => console.log("CX LAX departures:", list))
.catch(err => console.error(err));
Add real-time status and gates for CX flights
Once you have the list of candidate CX flights touching LAX, you’ll often need real-time status values like en-route vs landed, and any gate or ETA changes. FlightLabs provides a real-time tracking payload with current status, times, and position data.
Official real-time tracking sample payload
Below is the official structure you should parse for live CX flights at or around LAX. The values are illustrative; your app should read the same fields for Cathay Pacific flights by flight number, callsign, or other real-time queries supported by your integration.
{
"success": true,
"data": {
"flight": {
"iata": "AA123",
"icao": "AAL123",
"number": "123",
"status": "en-route",
"departure": {
"airport": "JFK",
"scheduled": "2024-03-20T10:00:00Z",
"actual": "2024-03-20T10:05:00Z",
"terminal": "8",
"gate": "B12"
},
"arrival": {
"airport": "LAX",
"scheduled": "2024-03-20T13:15:00Z",
"estimated": "2024-03-20T13:20:00Z",
"terminal": "4",
"gate": "45A"
},
"position": {
"latitude": 39.8729,
"longitude": -98.7372,
"altitude": 35000,
"speed": 495,
"heading": 270
}
}
}
}
Key fields to wire up for CX:
- flight.status: drive UX state (scheduled, departed, en-route, landed, cancelled, diverted when applicable).
- departure.actual vs departure.scheduled: compute departure delay and show “departed at” messaging.
- arrival.estimated: most important predicted field for ETAs and downstream logistics.
- departure.terminal / gate and arrival.terminal / gate: feed airport display boards and mobile alerts.
- position: only needed for live maps and en-route progress bars.
In your integration, look up CX flights by flight number (e.g., CXxxx) or use airline/context filters, then join the real-time payload with schedule results by number and dates. Use UTC for internal joins and localize for display.
How the endpoints compare for CX at LAX
| Endpoint Category | Primary Use for CX at LAX | Critical Fields | Update Style | Polling/Caching Guidance |
|---|---|---|---|---|
| Flight Schedules | Build CX arrivals/departures lists for LAX with times and terminals. | airline.iata, flight_number, departure/arrival.scheduled, terminals | Scheduled snapshots | Cache for 10–30 minutes; refresh more often during peak hours. |
| Real-time Tracking | Live status, gates, ETAs for CX flights currently operating to/from LAX. | status, departure.actual, arrival.estimated, gates, terminals, position | Frequent updates | Poll active flights every 30–60 seconds; back off when status is final. |
| Flight History | Backfill CX operational logs and analytics for LAX routes. | Final times, status outcomes | Static after completion | Cache indefinitely for completed flights. |
| Future Flights | Longer-horizon planning for upcoming CX service into/out of LAX. | Planned schedules, identifiers | Low-frequency changes | Daily or twice-daily refresh is often sufficient. |
Use cases tied to CX at LAX
1) Flight status boards for CX at LAX
Combine schedules for the base list and real-time for live updates:
- Fields: airline.iata="CX", flight_number, departure/arrival.scheduled for the grid; status, gates, estimated for live rows.
- Flow: pull LAX schedules (departures and arrivals), filter to CX; for any flight occurring within the next 12 hours, fetch real-time details and merge by flight number.
- Display: convert UTC to America/Los_Angeles for LAX panels; preserve UTC internally for joins.
2) Delay monitoring and alerting
- Detect delay by comparing departure.actual to departure.scheduled (or arrival.estimated to arrival.scheduled) from the real-time payload.
- Trigger thresholds: e.g., 15+ minutes off schedule -> notify ops or travelers subscribed to CX flights at LAX.
- Maintain a small cache of recent real-time responses to avoid rate spikes during surges.
3) Route analysis: CX long-hauls touching LAX
- Start with schedules to enumerate distinct LAX routes served by CX (airline.iata="CX" and LAX in departure/arrival).
- Use Flight History for completed flights to compute distributions of block times and identify seasonal patterns. Keep results in your own datastore for faster reporting.
- Future Flights offers longer-range planning for capacity previews.
Implementation details that save time
Time zones and UTC
- Schedules and real-time sample timestamps use ISO-8601 in UTC (Z). Convert to the local time zone for display (e.g., America/Los_Angeles for LAX; Asia/Hong_Kong for HKG) and clearly label time zones in UI.
- When joining schedule and real-time data, do comparisons in UTC to avoid DST and offset surprises.
Polling frequency and caching
- Schedules: cache results for 10–30 minutes; re-fetch more frequently during local peak hours, and segment arrivals vs departures to reduce payload size.
- Real-time: poll active CX flights at 30–60 second intervals; back off (2–5 minutes) when a flight is scheduled but not yet at the gate, and stop polling when status is final (e.g., landed, cancelled).
- Implement conditional polling per flight: increase frequency when departure is imminent or when arrival.estimated changes significantly.
Handling cancelled and diverted flights
- Use flight.status from the real-time payload to switch logic paths (e.g., show “Cancelled” prominently; for “Diverted,” replace arrival airport in the UI if provided and suppress LAX gate info).
- For cancelled flights that still appear in schedules, retain the row but grey it out and stop polling after status is final.
Pagination and result windows
- Schedules queries may return many flights. If a paging mechanism is documented in your account, apply it; otherwise, segment calls by time windows (e.g., hourly or per terminal if applicable).
- Persist your last-successful window marker, so you can resume after transient errors without duplicating requests.
Matching CX flights across endpoints
- Primary key: airline.iata ("CX") + flight_number from schedules. In real-time, match to the combination of flight.iata (e.g., "CX123") or flight.number where available.
- If you build a callsign map (see Flights by Callsign), normalize to IATA flight numbers in your own store for consistency.
Step-by-step: building a CX@LAX status feed
1) Fetch schedules for LAX in both directions
- GET /flights-schedules?iataCode=LAX&type=departure
- GET /flights-schedules?iataCode=LAX&type=arrival
- Filter both lists for airline.iata === "CX". Store flight_number, terminals, and scheduled times.
2) Enrich with real-time when the flight is near operation
- For flights occurring within a time window (e.g., T-6h to T+6h), query real-time status and update status, gates, and ETAs.
- Display delays by comparing actual vs scheduled (dept) and estimated vs scheduled (arr).
3) Fall back to history after completion
- Once status is final, you can archive the record. Use history endpoints to audit or re-validate times post-event if needed.
Error handling and resilience
- Network errors: retry with exponential backoff; cap retries to avoid storms.
- Partial data: not all flights will have terminal or gate immediately—treat these as nullable fields and render “TBD”.
- Data drift: don’t assume gate immutability; update when new values differ, and keep a change timestamp.
- Out-of-order updates: rely on timestamps (actual, estimated) and status precedence to merge updates safely.
Management and tooling
- You can explore and test requests within the MCP before wiring production code.
- Refer to official endpoint descriptions and field definitions in the Documentation when adding features like future flights or flight info by number.
Security, pricing, and quota notes
- Authentication: requests require an API key. Store it securely and never expose it in client-side code for public apps.
- Pricing: a Starter plan is available at $24.99/month, and you can evaluate via a limited trial (7 days or 50 requests). For current terms, check your account area.
- If you expect high traffic (e.g., airport displays), implement caching layers and selective polling to stay within your plan quotas.
Production checklist for CX@LAX
- Filter schedules by airline.iata === "CX" and LAX directionality.
- Normalize all times in UTC for storage; convert to local zones for output.
- Poll real-time only for flights in an operational window; back off for completed flights.
- Handle nullable terminal/gate fields gracefully; show “TBD” until present.
- Track status changes (“scheduled” → “departed” → “en-route” → “landed”) and stop polling on final states.
- Log API responses for diagnostics and to replay edge cases like diversions.
FAQs
How do I reliably match a real-time CX flight to a schedule row?
Use airline.iata ("CX") plus the numeric flight_number from schedules and join to real-time by the same number (flight.number) or IATA flight code (flight.iata). Keep joins in UTC time windows to avoid day-crossing mismatches on long-hauls.
What time zone should I display for LAX boards?
Store UTC from the API and display in America/Los_Angeles for LAX audiences. Always label the time zone. For CX inbound from HKG, consider offering both local times for origin and destination.
How often should I poll real-time for CX flights?
Every 30–60 seconds during the active phase (boarding through arrival). Increase frequency only when you detect meaningful changes (e.g., arrival.estimated shifts). Back off to 2–5 minutes when flights are far from operation and stop polling once status is final.
How do I handle cancelled or diverted CX flights?
Watch flight.status in the real-time payload. If “cancelled,” retain the row with a clear label and cease further polling. If “diverted,” update the arrival airport/gate accordingly and suppress LAX gate displays if the flight no longer arrives at LAX.
Can I get long-range CX schedules into/out of LAX?
Yes—use Flight Schedules alongside Future Flights to plan beyond the near-term window. For detailed behavior, consult the Documentation.
Ready to build your CX@LAX workflow with real schedules and live status? Get your API key now and start integrating in minutes: Register.