API to Get Air New Zealand (NZ) Flights
You need to programmatically find, track, and display Air New Zealand (IATA: NZ) flights in your product. By the end of this guide you will be able to call FlightLabs endpoints to retrieve NZ flight schedules, interpret live status fields (departure/arrival times, terminals, gates), and build polling, caching, and error-handling around cancellations or diversions—ready for production.
Air New Zealand (NZ) in one paragraph
Air New Zealand (IATA: NZ) is the flag carrier of New Zealand. It operates from New Zealand, with Auckland Airport commonly recognized as a primary hub. In this article, we’ll focus on how to retrieve NZ flights and related data using the FlightLabs API so you can power developer-facing features like status boards, route explorers, and near-real-time monitoring.
Which FlightLabs endpoints matter for NZ flights
FlightLabs provides separate endpoints for real-time operations, flight schedules (including future flights), historical lookups, and routes. For Air New Zealand use cases, the most relevant endpoints are:
- Flight Schedules: find upcoming or planned NZ legs by airline code. Endpoint: /flights-schedules with iataCode and type parameters.
- Real-time Flight Tracking: get current status, timestamps, terminal and gate information, plus position when available.
- Flight History and Future Flights: enrich dashboards with past or forward-looking operations.
- Routes: understand possible city pairs and plan coverage views.
All endpoints return JSON and are available over REST from the FlightLabs platform. See the Documentation for full field and filtering options.
Quick comparison of endpoints you’ll use
| Category | Endpoint (docs) | Primary filters | Key fields you’ll use | Typical use with NZ |
|---|---|---|---|---|
| Flight Schedules | https://www.goflightlabs.com/flights-schedules | iataCode, type | flight_number, departure.scheduled, arrival.scheduled, airline.iata | Build daily/weekly NZ timetables and show planned times |
| Real-time Tracking | https://www.goflightlabs.com/real-time | e.g., flight number, callsign (see docs) | status, departure.actual, arrival.estimated, terminal, gate, position | Render live NZ flight boards and maps |
| Flight History | https://www.goflightlabs.com/flights-history | Date/time, flight identifiers (see docs) | status over time, actual off/on times | Ops analysis for NZ legs (e.g., historical punctuality studies) |
| Future Flights | https://www.goflightlabs.com/future-flights | Airline, airports (see docs) | upcoming planned segments | Trip planning features for NZ network |
| Routes | https://www.goflightlabs.com/retrieve-routes | Airline, origin/destination | city pairs, carrier info | Show where NZ flies and potential connections |
Get Air New Zealand schedules by airline code (NZ)
Schedules are the starting point for discovering which NZ flights are planned to operate and when. Use the schedules endpoint with iataCode set to NZ and type set to airline.
curl request
The following example queries the schedules index for Air New Zealand (NZ). Replace YOUR_API_KEY with your key from FlightLabs:
curl -G "https://api.goflightlabs.com/flights-schedules" \
--data-urlencode "iataCode=NZ" \
--data-urlencode "type=airline" \
--data-urlencode "api_key=YOUR_API_KEY"
Response fields to expect include:
- flight_number: the flight designator number (pair it with the airline code).
- departure.scheduled and arrival.scheduled: UTC timestamps for planned times.
- departure.airport and arrival.airport: IATA codes for airports.
- airline.iata: will be NZ for Air New Zealand in this query.
- aircraft fields may include informative type/registration details when provided.
JavaScript example: rendering a minimal NZ timetable
async function fetchNZSchedules() {
const params = new URLSearchParams({
iataCode: "NZ",
type: "airline",
api_key: "YOUR_API_KEY"
});
const url = `https://api.goflightlabs.com/flights-schedules?${params.toString()}`;
const res = await fetch(url);
if (!res.ok) {
throw new Error(`HTTP ${res.status}`);
}
const json = await res.json();
// Expecting a structure similar to the official schedules example.
const rows = (json.data && json.data.schedules) ? json.data.schedules : [];
return rows.map(s => ({
airline: s.airline?.iata,
flightNumber: s.flight_number,
depAirport: s.departure?.airport,
depScheduledUtc: s.departure?.scheduled,
arrAirport: s.arrival?.airport,
arrScheduledUtc: s.arrival?.scheduled,
aircraft: s.aircraft?.type
}));
}
// Example rendering:
fetchNZSchedules()
.then(rows => {
rows.slice(0, 10).forEach(r => {
console.log(
`${r.airline}${r.flightNumber}: ${r.depAirport} (${r.depScheduledUtc}) - ` +
`${r.arrAirport} (${r.arrScheduledUtc})` +
(r.aircraft ? ` [${r.aircraft}]` : "")
);
});
})
.catch(err => console.error(err));
Notes on timestamps and zones:
- Scheduled and estimated/actual times are returned in UTC in the examples below. Normalize to UTC internally, then convert to local airport time zones for display.
- When matching to airport local time, use the airport’s time zone field (available from the Airport Information category) or your own time zone database.
Interpreting real-time flight fields for live NZ operations
When your users need “what’s happening now,” call the real-time category. The official sample below shows the shape of a real-time response, including the status string and nested departure/arrival objects with terminals and gates.
Official sample: Real-time Flight Tracking response
{
"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
}
}
}
}
Fields you’ll actually use:
- status: “scheduled,” “en-route,” “landed,” etc. Use this to drive your UI state.
- departure.scheduled and departure.actual: compare for pushback/off-block delay.
- arrival.scheduled and arrival.estimated: show latest expected arrival time.
- terminal and gate: render airport signage-like details if present.
- position: optional geospatial info (lat/lon, altitude, speed, heading) for maps.
To use this for Air New Zealand, query by NZ identifiers (e.g., NZ flight number or callsign) according to the filtering described in the Documentation, then parse the same fields above.
Practical handling: time zones, polling, caching, and edge cases
Implementing live tracking and schedules for NZ flights requires a few production-grade details:
- Time zones and UTC:
- Store and compare all timestamps in UTC to avoid daylight saving complexity across New Zealand and international destinations.
- Convert to local time for display using your client locale or airport time zone info.
- Polling and caching:
- For “near real-time” status, poll every 30–60 seconds while a flight is “en-route,” and back off (e.g., every 3–5 minutes) when “scheduled” or “landed.”
- Cache schedules more aggressively (e.g., hourly). Invalidate cache upon first detection of a state transition (e.g., scheduled → active) to reflect real-time changes promptly.
- Cancelled or diverted flights:
- Expect status changes indicating non-standard operations. When cancelled, clear terminals/gates and set a strong visual indicator in your UI.
- For diversions, arrival.airport may differ from scheduled; always render both planned and latest fields when they diverge.
- Pagination:
- Schedules endpoints can return many items for NZ. Implement pagination and incremental fetches (consult docs for page/limit parameters) to avoid timeouts and large payloads.
Use cases tied to Air New Zealand data
1) Live flight status pages for NZ departures/arrivals
Combine Flight Schedules for planned times with Real-time Tracking for current status. Key fields:
- status: to segment “scheduled,” “boarding,” “en-route,” “landed.”
- departure.actual vs. departure.scheduled: compute off-block delay.
- arrival.estimated vs. arrival.scheduled: show ETA adjustments.
- terminal/gate: give travelers actionable information where available.
Strategy: use schedules to pre-render a day’s NZ flights, then poll real-time data during the window around each flight (T-90 min to arrival). Cache aggressively outside those windows.
2) Delay monitoring for operations or traveler notifications
Trigger alerts when actual or estimated times deviate from scheduled by a threshold (e.g., 10–15 minutes). Key fields:
- departure.actual and arrival.estimated compared to scheduled.
- status transitions to detect gate changes or unexpected holds.
Strategy: store baseline schedule times for each NZ flight number, then push notifications or webhook callbacks as soon as a new polling cycle reveals a variance.
3) Route analysis for NZ network coverage
Use Schedules to observe which airports appear in departure/arrival for NZ, and pair with the Routes category for a canonical list. Key fields:
- departure.airport and arrival.airport to compute city pairs.
- airline.iata == NZ to filter cleanly to the carrier.
Strategy: build a graph of airports from schedules snapshots, aggregate by frequency over a defined period with Flight History, and visualize NZ connectivity.
End-to-end example: find NZ schedules, then correlate to live status
Below is a two-step outline for building a unified NZ flight board:
- Fetch schedules using iataCode=NZ and type=airline to list planned operations for your time window. Store flight_number and departure/arrival airports and scheduled times.
- For each active or imminent NZ flight number, call real-time tracking (by flight number or callsign per docs) to get status, terminals, gates, and estimated/actual times. Update your cache and UI accordingly.
When you detect “landed” or a terminal/gate removal (post-arrival cleanup), stop polling that flight and mark it as complete. For cancelled flights, remove gates and add a cancellation banner while retaining the original schedule metadata for context.
Airport information for local-time rendering and context
When displaying NZ flights into or out of varied time zones, use Airport Information to determine local offsets and context like terminals. The official airport sample (for JFK) illustrates structure such as timezone and location that you can use to render correct local times and maps. Tie this to departure.airport and arrival.airport codes from the schedules or real-time responses.
Implementation details that save time
- IDs and lookups:
- Standardize on IATA codes (NZ for airline; three-letter codes for airports) as your primary keys to match FlightLabs responses.
- De-duplication:
- Schedules may contain multiple entries for the same flight number on different days or legs; combine airline.iata + flight_number + departure.scheduled to create a stable key.
- Error handling:
- Handle cases where terminal or gate is absent. Don’t assume those fields appear for every airport or every phase of operation.
- Security and keys:
- Store your API key securely server-side. If you need client-side calls, proxy through your backend or the MCP environment in a controlled way.
Field dictionary: what to map in your data model
- airline.iata (NZ): partition data by carrier.
- flight_number: combine with airline.iata to uniquely reference the flight.
- departure.airport, arrival.airport: IATA codes of origin/destination.
- departure.scheduled, arrival.scheduled: baseline UTC for timetable views.
- departure.actual, arrival.estimated: live deltas for ops and traveler comms.
- terminal, gate: display when present; hide gracefully when absent.
- position: enable map rendering when real-time data is available.
A note on production performance and quotas
To stay within plan quotas and maintain responsiveness, batch your schedule fetches (e.g., fetch a rolling window, cache the result), then use low-latency polling only for active NZ flights. Use exponential backoff on HTTP errors, and instrument both success and error rates per endpoint to spot transient issues. For pricing, the Starter plan is $24.99 per month, and a trial is available (7 days or 50 requests). For full details and latest terms, check the FlightLabs site.
Additional sample: Flight Schedule response shape
The schedules response below shows key nested objects you will parse for NZ as well (official sample values shown):
{
"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"
}
}
]
}
}
What to map:
- data.schedules[]: array of scheduled flights.
- flight_number + airline.iata: your canonical identifier (e.g., NZ123).
- departure.scheduled and arrival.scheduled: store as UTC timestamps.
- departure.airport and arrival.airport: for routing and local-time conversions.
- aircraft information (if present): useful for seat maps or aircraft filtering.
Python snippet: normalize NZ schedule rows
import requests
from datetime import datetime, timezone
def fetch_nz_schedules():
url = "https://api.goflightlabs.com/flights-schedules"
params = {
"iataCode": "NZ",
"type": "airline",
"api_key": "YOUR_API_KEY"
}
r = requests.get(url, params=params, timeout=20)
r.raise_for_status()
payload = r.json()
schedules = (payload.get("data") or {}).get("schedules") or []
normalized = []
for s in schedules:
dep = s.get("departure", {})
arr = s.get("arrival", {})
airline = s.get("airline", {})
row = {
"airline_iata": airline.get("iata"),
"flight_number": s.get("flight_number"),
"dep_airport": dep.get("airport"),
"dep_scheduled_utc": dep.get("scheduled"),
"dep_terminal": dep.get("terminal"),
"arr_airport": arr.get("airport"),
"arr_scheduled_utc": arr.get("scheduled"),
"arr_terminal": arr.get("terminal"),
"aircraft_type": (s.get("aircraft") or {}).get("type")
}
normalized.append(row)
return normalized
if __name__ == "__main__":
rows = fetch_nz_schedules()
# Convert the first 5 rows to a readable string with local time example:
for r in rows[:5]:
dep_utc = r["dep_scheduled_utc"]
arr_utc = r["arr_scheduled_utc"]
print(f"{r['airline_iata']}{r['flight_number']}: "
f"{r['dep_airport']} ({dep_utc}) → {r['arr_airport']} ({arr_utc})"
f"{' | ' + r['aircraft_type'] if r['aircraft_type'] else ''}")
Bringing it together with your stack
Once your NZ integration works end-to-end, productionize it with:
- Job scheduling: a cron or queue worker to refresh schedules on a rolling basis.
- Caching: store the normalized schedule rows for NZ in a short-lived cache; use identifiers to correlate with live status updates.
- UI state machine: render a state based on status and timestamps (planned, boarding, gate closed, en-route, diverted, cancelled, landed).
- Observability: log response sizes and latencies per endpoint category for tuning polling frequency.
Get your API key and explore interactively
Sign up to get an API key and try these queries against Air New Zealand data. Start in the Documentation to see all request/response fields, then test in your environment or in the MCP console for quick iteration.
FAQ
- How do I filter schedules strictly to Air New Zealand?
Use iataCode=NZ with type=airline on the schedules endpoint. Store airline.iata from responses to validate. - Are times returned in local or UTC?
In the samples above, times are UTC. Normalize to UTC internally and convert to airport local time at render time. - How often should I poll for live NZ flight status?
Poll more frequently (30–60s) only while flights are active or within a pre-departure window. Back off to several minutes for non-active flights to reduce load. - What happens for cancelled or diverted flights?
Expect status changes and potential differences between scheduled and actual/estimated or between scheduled and latest airports. Always render both planned and latest fields when they differ. - Can I paginate through a full day of NZ schedules?
Yes. Implement pagination per the endpoint’s documentation to handle large result sets efficiently.
Ready to put NZ schedules and live status into production? Get your key now and start building with FlightLabs: Register. For a deeper dive into request parameters and fields, head to the Documentation, and test interactively in MCP.