Error handling

Caching and quotas: Caching & monitoring.

Platform errors (401, 403, 422, 429, 5xx): Error Handling.

Flight status

GET /flight_status/{flight_number} returns 404 when the flight is not published for today — not when your code is wrong. There is no date parameter; use Schedules for board data on a specific day.

Gate, terminal, baggage, and check-in fields are often empty strings ("") — treat them as unknown, not missing configuration.

Schedules

flights may be an empty array — that is a valid board state. Row keys use Title Case (Flight, Time, Status) — lowercase keys return undefined.

Distance

Returns 422 when airport codes cannot be resolved or coordinates are out of range.

Flight briefing

Briefing generation is slow (often 30–90 s) and may return 503 under load. Retry once after a short backoff; do not hammer the endpoint on every UI render.

Structured JSON uses summary, origin_briefing, and destination_briefing — not a sections wrapper.

import os
import time

import requests

HEADERS = {
    "X-RapidAPI-Key": os.getenv("RAPIDAPI_KEY", "YOUR_RAPIDAPI_KEY"),
    "X-RapidAPI-Host": "skylink-api.p.rapidapi.com",
}
BASE = "https://skylink-api.p.rapidapi.com"


def fetch_status(flight: str) -> dict | None:
    r = requests.get(f"{BASE}/flight_status/{flight}", headers=HEADERS, timeout=(10, 15))
    if r.status_code == 404:
        return None
    r.raise_for_status()
    return r.json()


def fetch_briefing(origin: str, destination: str) -> dict | None:
    params = {
        "origin": origin,
        "destination": destination,
        "include_weather": "true",
        "include_notams": "true",
        "format": "json",
    }
    for attempt in range(2):
        r = requests.get(
            f"{BASE}/briefing/flight",
            headers=HEADERS,
            params=params,
            timeout=(10, 90),
        )
        if r.status_code == 404:
            return None
        if r.status_code in (502, 503, 504):
            if attempt == 0:
                time.sleep(8)
                continue
            return None
        r.raise_for_status()
        return r.json()
    return None


if __name__ == "__main__":
    status = fetch_status("BA123")
    print("Status:", status["status"] if status else "not found today")
    print("Briefing smoke test: see flight-briefing-integration (60–90 s generation time)")

For transient failures, use the retry helper on Error Handling.


Related: Flight status · Schedules · Distance · Flight briefing · Caching & monitoring