{
  "openapi": "3.1.0",
  "info": {
    "title": "FlightTracker API — Real-Time Global ADS-B, Airspace Radar & FAA Airport Delay API",
    "version": "1.0.0",
    "description": "Commercially-licensed real-time global ADS-B aircraft positions, callsign/ICAO24/tail tracking, 1–250 NM geofence airspace radar, live US FAA National Airspace System (NAS) airport delays & ground stops, and embedded 49,000+ global airports & 6,100+ airlines directory. 90% cheaper than AeroAPI. Data attribution: adsb.lol (ODbL 1.0) & FAA NAS Public Domain.",
    "contact": {
      "name": "FlightTracker API Support",
      "url": "https://flighttrackerapi.com/docs",
      "email": "support@flighttrackerapi.com"
    }
  },
  "servers": [
    {
      "url": "https://api.flighttrackerapi.com",
      "description": "Production Global Aviation Gateway"
    }
  ],
  "security": [
    { "ApiKeyAuth": [] },
    { "BearerAuth": [] }
  ],
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "API key (ft_live_...). Claim 3,000 Free Credits ($0.30) on sign-up at https://flighttrackerapi.com/signup."
      },
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "API key (ft_live_...) or MCP OAuth 2.1 access token (mcp_at_...)."
      }
    }
  },
  "paths": {
    "/v1/flights/callsign": {
      "get": {
        "operationId": "trackFlightByCallsign",
        "summary": "Track live aircraft by callsign, ICAO24 hex, tail registration, or squawk",
        "description": "Returns real-time ADS-B telemetry (lat, lon, barometric/geometric altitude, flight level, groundspeed kts, track/heading, vertical rate, aircraft type, airline metadata, squawk) via commercially-permitted adsb.lol (ODbL 1.0). Cost: 5 Credits / call ($0.0005; 0 Credits if not airborne).",
        "parameters": [
          { "name": "callsign", "in": "query", "schema": { "type": "string", "example": "UAL921" }, "description": "ATC callsign (e.g. UAL921, BAW117)." },
          { "name": "icao24", "in": "query", "schema": { "type": "string", "example": "a8c121" }, "description": "6-character hex ICAO24 Mode-S transponder address." },
          { "name": "reg", "in": "query", "schema": { "type": "string", "example": "N663UA" }, "description": "Aircraft tail registration number." },
          { "name": "squawk", "in": "query", "schema": { "type": "string", "example": "0703" }, "description": "4-digit octal squawk code." }
        ],
        "responses": {
          "200": {
            "description": "Live ADS-B telemetry for matching aircraft",
            "content": {
              "application/json": {
                "example": {
                  "code": 0,
                  "provider": "https://flighttrackerapi.com",
                  "status": "ok",
                  "msg": "success",
                  "data": {
                    "query_mode": "callsign",
                    "query_value": "UAL921",
                    "count": 1,
                    "flight": {
                      "icao24": "a8c121",
                      "callsign": "UAL921",
                      "registration": "N663UA",
                      "aircraft_type": "B763",
                      "airline": { "name": "United Airlines", "iata": "UA", "icao": "UAL", "callsign": "UNITED", "country": "United States" },
                      "lat": 40.567436,
                      "lon": -74.417142,
                      "altitude_baro_ft": 3275,
                      "altitude_geom_ft": 3700,
                      "flight_level": null,
                      "on_ground": false,
                      "ground_speed_kts": 159.4,
                      "track_deg": 108.66,
                      "vertical_rate_fpm": -128,
                      "squawk": "0703",
                      "emergency": "none",
                      "seen_seconds_ago": 0.4
                    },
                    "attribution": "Data attribution: adsb.lol (ODbL 1.0)"
                  },
                  "meta": { "endpoint": "/v1/flights/callsign", "credits_per_call": 5, "credits_charged": 5, "cached": false, "took_ms": 142 }
                }
              }
            }
          }
        }
      }
    },
    "/v1/flights/nearby": {
      "get": {
        "operationId": "scanAirspaceNearby",
        "summary": "Real-time geofence airspace radius radar around coordinates or airport",
        "description": "Scans all live ADS-B aircraft within 1–250 nautical miles of lat/lon or an airport IATA/ICAO code (e.g. airport=LHR). Cached 15s in Redis (ft:). Cost: 2 Credits / aircraft returned ($0.20 / 1K positions; $0.08 / 1K on Business).",
        "parameters": [
          { "name": "lat", "in": "query", "schema": { "type": "number", "example": 51.47 }, "description": "Center latitude (-90..90)." },
          { "name": "lon", "in": "query", "schema": { "type": "number", "example": -0.4543 }, "description": "Center longitude (-180..180)." },
          { "name": "airport", "in": "query", "schema": { "type": "string", "example": "LHR" }, "description": "Optional IATA/ICAO airport code auto-resolved to lat/lon." },
          { "name": "radius_nm", "in": "query", "schema": { "type": "number", "default": 50, "minimum": 1, "maximum": 250 }, "description": "Search radius in nautical miles (1–250)." },
          { "name": "limit", "in": "query", "schema": { "type": "integer", "default": 25, "minimum": 1, "maximum": 100 }, "description": "Max aircraft returned (1–100)." },
          { "name": "on_ground", "in": "query", "schema": { "type": "boolean" }, "description": "Filter by ground/airborne state." },
          { "name": "airline", "in": "query", "schema": { "type": "string", "example": "BAW" }, "description": "Optional airline ICAO/IATA filter." }
        ],
        "responses": {
          "200": {
            "description": "Live aircraft sorted by distance_nm",
            "content": {
              "application/json": {
                "example": {
                  "code": 0,
                  "provider": "https://flighttrackerapi.com",
                  "status": "ok",
                  "msg": "success",
                  "data": {
                    "center": { "lat": 51.47, "lon": -0.4543, "radius_nm": 50 },
                    "total_in_radius": 216,
                    "count": 2,
                    "limit": 25,
                    "flights": [
                      {
                        "icao24": "407574",
                        "callsign": "BAW117",
                        "registration": "G-XWBA",
                        "aircraft_type": "A35K",
                        "lat": 51.4712,
                        "lon": -0.4611,
                        "altitude_baro_ft": 2450,
                        "ground_speed_kts": 162.5,
                        "track_deg": 271.2,
                        "squawk": "5214",
                        "on_ground": false,
                        "distance_nm": 0.27
                      }
                    ],
                    "attribution": "Data attribution: adsb.lol (ODbL 1.0)"
                  },
                  "meta": { "endpoint": "/v1/flights/nearby", "credits_per_item": 2, "credits_charged": 2, "cached": false, "cache_ttl_sec": 15, "took_ms": 188 }
                }
              }
            }
          }
        }
      }
    },
    "/v1/airports/delays": {
      "get": {
        "operationId": "getFaaAirportDelays",
        "summary": "Live US FAA National Airspace System (NAS) airport delays, ground stops & closures",
        "description": "Parses official US Government Public Domain FAA NAS status XML into structured JSON ground stops, ground delay programs, arrival/departure delays, weather closures, and airspace flow programs. Cost: 5 Credits / call ($0.0005).",
        "parameters": [
          { "name": "iata", "in": "query", "schema": { "type": "string", "example": "JFK" }, "description": "Optional 3-letter US IATA code (e.g. JFK, EWR, MIA, SFO). Omit for all active US delays." }
        ],
        "responses": {
          "200": {
            "description": "Live FAA NAS delay report",
            "content": {
              "application/json": {
                "example": {
                  "code": 0,
                  "provider": "https://flighttrackerapi.com",
                  "status": "ok",
                  "msg": "success",
                  "data": {
                    "iata": "JFK",
                    "icao": "KJFK",
                    "airport_name": "John F Kennedy International Airport",
                    "city": "New York",
                    "region": "US-NY",
                    "has_delay": false,
                    "operational_status": "normal",
                    "active_events_count": 0,
                    "active_events": [],
                    "attribution": "Data source: FAA National Airspace System Status (US Government Public Domain)"
                  },
                  "meta": { "endpoint": "/v1/airports/delays", "credits_per_call": 5, "credits_charged": 5, "cached": true, "took_ms": 12 }
                }
              }
            }
          }
        }
      }
    },
    "/v1/airports/lookup": {
      "get": {
        "operationId": "lookupAirportsAndAirlines",
        "summary": "Search 49,000+ global airports & 6,100+ airlines (IATA/ICAO/coordinates/timezone)",
        "description": "Sub-millisecond embedded lookup across 49,000+ global airports and 6,100+ airlines by name, city, IATA, ICAO, or country ISO code. Cost: 2 Credits / call ($0.0002).",
        "parameters": [
          { "name": "query", "in": "query", "schema": { "type": "string", "example": "Heathrow" }, "description": "Airport/city/airline search query." },
          { "name": "iata", "in": "query", "schema": { "type": "string", "example": "LHR" }, "description": "Exact 3-letter IATA airport code." },
          { "name": "icao", "in": "query", "schema": { "type": "string", "example": "EGLL" }, "description": "Exact 4-letter ICAO airport code." },
          { "name": "airline", "in": "query", "schema": { "type": "string", "example": "UAL" }, "description": "Airline name, IATA, or ICAO code." },
          { "name": "type", "in": "query", "schema": { "type": "string", "enum": ["airport", "airline", "all"], "default": "all" } },
          { "name": "limit", "in": "query", "schema": { "type": "integer", "default": 15, "minimum": 1, "maximum": 50 } }
        ],
        "responses": {
          "200": {
            "description": "Matched global airports and airlines",
            "content": {
              "application/json": {
                "example": {
                  "code": 0,
                  "provider": "https://flighttrackerapi.com",
                  "status": "ok",
                  "msg": "success",
                  "data": {
                    "query": "Heathrow",
                    "type": "all",
                    "count": 1,
                    "airports_count": 1,
                    "airlines_count": 0,
                    "airports": [
                      {
                        "iata": "LHR",
                        "icao": "EGLL",
                        "ident": "EGLL",
                        "name": "London Heathrow Airport",
                        "city": "London",
                        "country": "GB",
                        "region": "GB-ENG",
                        "type": "large_airport",
                        "lat": 51.4706,
                        "lon": -0.4619,
                        "elevation_ft": 83,
                        "timezone": "Europe/London"
                      }
                    ],
                    "airlines": []
                  },
                  "meta": { "endpoint": "/v1/airports/lookup", "credits_per_call": 2, "credits_charged": 2, "cached": true, "took_ms": 2 }
                }
              }
            }
          }
        }
      }
    },
    "/v1/health": {
      "get": {
        "operationId": "getHealth",
        "summary": "Gateway health & indexed aviation directory coverage check (0 credits)",
        "security": [],
        "responses": {
          "200": {
            "description": "Gateway healthy",
            "content": {
              "application/json": {
                "example": {
                  "code": 0,
                  "provider": "https://flighttrackerapi.com",
                  "status": "ok",
                  "msg": "success",
                  "data": {
                    "service": "flighttrackerapi-gateway",
                    "status": "healthy",
                    "endpoints_count": 4,
                    "airports_indexed": 49343,
                    "airlines_indexed": 6160
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
