{
  "openapi": "3.1.0",
  "info": {
    "title": "FlightTrackerLED Flight Route API",
    "version": "1.0.0",
    "summary": "Origin and destination for a flight, by callsign.",
    "description": "Look up an airline flight's route by callsign. Scheduled airline and cargo flights in United States airspace. Information only; not for navigation or any operational use.",
    "termsOfService": "https://www.flighttrackerled.com/api/docs#terms",
    "contact": {
      "name": "FlightTrackerLED",
      "email": "hello@flighttrackerled.com",
      "url": "https://www.flighttrackerled.com/api/"
    }
  },
  "servers": [
    {
      "url": "https://www.flighttrackerled.com/api/v1"
    }
  ],
  "externalDocs": {
    "description": "Documentation",
    "url": "https://www.flighttrackerled.com/api/docs"
  },
  "security": [
    {
      "bearerKey": []
    }
  ],
  "paths": {
    "/routes/{callsign}": {
      "get": {
        "operationId": "getRoute",
        "summary": "Route lookup by callsign",
        "parameters": [
          {
            "name": "callsign",
            "in": "path",
            "required": true,
            "description": "Airline callsign: three-letter ICAO airline code, then the flight number.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z]{3}[0-9][A-Za-z0-9]{0,4}$"
            },
            "example": "UAL1971"
          },
          {
            "name": "hex",
            "in": "query",
            "description": "The aircraft's 24-bit ICAO address, six hexadecimal characters. Used for the match only.",
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-fA-F]{6}$"
            }
          },
          {
            "name": "lat",
            "in": "query",
            "description": "Aircraft latitude, decimal degrees. Send with lon.",
            "schema": {
              "type": "number",
              "minimum": -90,
              "maximum": 90
            }
          },
          {
            "name": "lon",
            "in": "query",
            "description": "Aircraft longitude, decimal degrees. Send with lat.",
            "schema": {
              "type": "number",
              "minimum": -180,
              "maximum": 180
            }
          },
          {
            "name": "alt",
            "in": "query",
            "description": "Aircraft altitude in feet.",
            "schema": {
              "type": "integer",
              "minimum": -2000,
              "maximum": 100000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The route, or found:false.",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                }
              },
              "X-Quota-Limit": {
                "schema": {
                  "type": "integer"
                }
              },
              "X-Quota-Remaining": {
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Route"
                }
              }
            }
          },
          "400": {
            "description": "invalid_callsign or invalid_request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "no_active_plan or cross_site",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited or quota_exceeded; see Retry-After",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "unavailable; see Retry-After. Not counted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/usage": {
      "get": {
        "operationId": "getUsage",
        "summary": "This account's usage and limits",
        "responses": {
          "200": {
            "description": "Usage this calendar month (UTC).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Usage"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/status": {
      "get": {
        "operationId": "getStatus",
        "summary": "Service status",
        "security": [],
        "responses": {
          "200": {
            "description": "operational or degraded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Status"
                }
              }
            }
          },
          "503": {
            "description": "unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Status"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "An API key from https://www.flighttrackerled.com/api/dashboard, starting ftl_live_."
      }
    },
    "schemas": {
      "Route": {
        "type": "object",
        "required": [
          "ok",
          "callsign",
          "found",
          "confidence",
          "airline",
          "origin",
          "destination",
          "status",
          "aircraftType",
          "updatedAt"
        ],
        "properties": {
          "ok": {
            "const": true
          },
          "callsign": {
            "type": "string",
            "examples": [
              "UAL1971"
            ]
          },
          "found": {
            "type": "boolean"
          },
          "confidence": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "high",
              "medium",
              null
            ],
            "description": "high: one flight fits. medium: the most likely of several legs filed under the callsign."
          },
          "airline": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "icao": {
                "type": "string",
                "examples": [
                  "UAL"
                ]
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ],
                "examples": [
                  "United"
                ]
              }
            }
          },
          "origin": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "icao": {
                "type": [
                  "string",
                  "null"
                ],
                "examples": [
                  "KORD"
                ]
              },
              "iata": {
                "type": [
                  "string",
                  "null"
                ],
                "examples": [
                  "ORD"
                ]
              }
            }
          },
          "destination": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "icao": {
                "type": [
                  "string",
                  "null"
                ],
                "examples": [
                  "KORD"
                ]
              },
              "iata": {
                "type": [
                  "string",
                  "null"
                ],
                "examples": [
                  "ORD"
                ]
              }
            }
          },
          "status": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "scheduled",
              "taxiing",
              "airborne",
              "landed",
              "arrived",
              "cancelled",
              null
            ]
          },
          "aircraftType": {
            "type": [
              "string",
              "null"
            ],
            "examples": [
              "B39M"
            ]
          },
          "updatedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "Usage": {
        "type": "object",
        "properties": {
          "ok": {
            "const": true
          },
          "access": {
            "type": "string",
            "enum": [
              "plan",
              "feeder",
              "none"
            ]
          },
          "month": {
            "type": "string",
            "examples": [
              "2026-11"
            ]
          },
          "requests": {
            "type": "object",
            "properties": {
              "used": {
                "type": "integer"
              },
              "limit": {
                "type": "integer"
              },
              "remaining": {
                "type": "integer"
              }
            }
          },
          "rateLimit": {
            "type": "object",
            "properties": {
              "requestsPerMinute": {
                "type": "integer"
              }
            }
          }
        }
      },
      "Status": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "enum": [
              "operational",
              "degraded",
              "unavailable"
            ]
          },
          "checkedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "ok",
          "code",
          "error"
        ],
        "properties": {
          "ok": {
            "const": false
          },
          "code": {
            "type": "string"
          },
          "error": {
            "type": "string"
          }
        }
      }
    }
  }
}
