{
  "openapi": "3.1.0",
  "info": {
    "title": "Adafruit Flight Watch public read API",
    "version": "1.1.0",
    "description": "Independent public monitor using FAA, NOAA/NWS and bounded adsb.lol samples. Read-only; no login/key. Identify your client honestly. HTTP 200 does not imply every upstream is healthy. Aircraft data: adsb.lol contributors, ODbL 1.0."
  },
  "servers": [
    {
      "url": "https://adafruit.ai/faa"
    }
  ],
  "security": [],
  "paths": {
    "/api/summary": {
      "get": {
        "operationId": "getFlightSummary",
        "summary": "Compact current report; inspect each source status. Empty events do not mean all clear.",
        "responses": {
          "200": {
            "description": "Compact current report; inspect each source status. Empty events do not mean all clear.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Summary"
                }
              }
            }
          },
          "400": {
            "description": "Invalid airport code",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "airport",
            "in": "query",
            "required": false,
            "description": "Three-character FAA/IATA airport code, optionally K-prefixed ICAO code. Example JFK or KJFK.",
            "schema": {
              "type": "string",
              "pattern": "^(?:[A-Za-z0-9]{3}|[Kk][A-Za-z]{3})$"
            }
          }
        ]
      }
    },
    "/feeds.json": {
      "get": {
        "operationId": "getFeedDirectory",
        "summary": "Direct government source URLs and current source health.",
        "responses": {
          "200": {
            "description": "Direct government source URLs and current source health.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "sources"
                  ],
                  "properties": {
                    "sources": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/SourceHealth"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/status": {
      "get": {
        "operationId": "getFullSnapshot",
        "summary": "Larger raw snapshot, source data, 7-day history. Epoch milliseconds except upstream NOAA obsTime in seconds.",
        "responses": {
          "200": {
            "description": "Larger raw snapshot, source data, 7-day history. Epoch milliseconds except upstream NOAA obsTime in seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "now",
                    "sources",
                    "history",
                    "changes"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/updates.atom": {
      "get": {
        "operationId": "getGovernmentFeed",
        "summary": "FAA observed airport changes and severe/extreme NWS alerts, plus available FAA newsroom items.",
        "responses": {
          "200": {
            "description": "FAA observed airport changes and severe/extreme NWS alerts, plus available FAA newsroom items.",
            "content": {
              "application/atom+xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "major",
            "in": "query",
            "description": "Set to 1 for automatic major changes only.",
            "schema": {
              "type": "string",
              "enum": [
                "1"
              ]
            }
          }
        ]
      }
    },
    "/weather.atom": {
      "get": {
        "operationId": "getWeatherFeed",
        "summary": "NOAA observations at eight airports; not a national forecast.",
        "responses": {
          "200": {
            "description": "NOAA observations at eight airports; not a national forecast.",
            "content": {
              "application/atom+xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/index.md": {
      "get": {
        "operationId": "getMarkdownReport",
        "summary": "Current report as front-matter Markdown for BonBon and other readers.",
        "responses": {
          "200": {
            "description": "Current report as front-matter Markdown for BonBon and other readers.",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/agents.txt": {
      "get": {
        "operationId": "getAgentGuide",
        "summary": "Canonical quick-start, interpretation rules and direct feeds.",
        "responses": {
          "200": {
            "description": "Canonical quick-start, interpretation rules and direct feeds.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/feeds.md": {
      "get": {
        "operationId": "getFeedGuide",
        "summary": "RSS/Atom quick-start and weather-source guide.",
        "responses": {
          "200": {
            "description": "RSS/Atom quick-start and weather-source guide.",
            "content": {
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/feeds.opml": {
      "get": {
        "operationId": "getSubscriptions",
        "summary": "Importable OPML subscription list.",
        "responses": {
          "200": {
            "description": "Importable OPML subscription list.",
            "content": {
              "text/x-opml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/cameras.json": {
      "get": {
        "operationId": "getCameraDirectory",
        "summary": "Curated public camera sources. Loading time is not observation time.",
        "responses": {
          "200": {
            "description": "Curated public camera sources. Loading time is not observation time.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/faa/api/health": {
      "get": {
        "summary": "Collector freshness, known source limits and recent independent watchdog checks",
        "responses": {
          "200": {
            "description": "Healthy or degraded collector; inspect per-source status"
          },
          "503": {
            "description": "Collector or core airport data unhealthy"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "SourceHealth": {
        "type": "object",
        "required": [
          "id",
          "directUrl",
          "refreshSeconds",
          "status",
          "stale"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "directUrl": {
            "type": "string",
            "format": "uri"
          },
          "refreshSeconds": {
            "type": "number"
          },
          "fetchedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "sourceSnapshotAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "ageSeconds": {
            "type": [
              "integer",
              "null"
            ]
          },
          "status": {
            "enum": [
              "available",
              "stale",
              "error"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "stale": {
            "type": "boolean"
          }
        }
      },
      "Summary": {
        "type": "object",
        "required": [
          "schemaVersion",
          "generatedAt",
          "national",
          "events",
          "sources",
          "coverage"
        ],
        "properties": {
          "schemaVersion": {
            "const": 1
          },
          "generatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "airportFilter": {
            "type": [
              "string",
              "null"
            ]
          },
          "national": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "ground-stop",
                  "cancelled",
                  "unconfirmed"
                ],
                "description": "Latest dated national advisory, not an all-clear for every flight."
              },
              "automaticallyVerified": {
                "type": "boolean",
                "description": "True only after original FAA advisory message and signed time were parsed."
              }
            },
            "additionalProperties": true
          },
          "events": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourceHealth"
            }
          },
          "coverage": {
            "type": "object"
          },
          "recentChanges": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "overview": {
            "type": "object",
            "description": "Counts of currently reported events in one selected FAA airport feed, with scheduled events and rows past their published end counted separately. Counts are null when current conditions cannot be verified.",
            "properties": {
              "airportStatus": {
                "type": "string",
                "enum": [
                  "current",
                  "last-known",
                  "unavailable"
                ]
              },
              "sourceId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "eventCount": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "airportCount": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "advisoriesStatus": {
                "type": "string",
                "enum": [
                  "available",
                  "stale",
                  "error",
                  "unavailable"
                ]
              }
            }
          },
          "incidentLog": {
            "type": "array",
            "description": "Dated editorial reports, nationwide notices and recent observations, newest first.",
            "items": {
              "type": "object"
            }
          },
          "majorChanges": {
            "type": "array",
            "description": "Seven days of observed FAA airport program and nationwide stop changes, newest first.",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "at": {
                  "type": "integer"
                },
                "expiresAt": {
                  "type": "integer"
                },
                "clock": {
                  "type": "string"
                },
                "sourceId": {
                  "type": "string"
                },
                "airport": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "title": {
                  "type": "string"
                },
                "detail": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "featured": {
                  "type": "boolean"
                }
              }
            }
          },
          "airlineWatch": {
            "type": "object",
            "description": "Delta and United newsroom coverage, independent of airport filtering. Open incidents have no time-based clearance. Resolved records remain for 30 days.",
            "properties": {
              "incidents": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "id",
                    "airline",
                    "status",
                    "opening",
                    "resolution"
                  ],
                  "properties": {
                    "airline": {
                      "enum": [
                        "delta",
                        "united"
                      ]
                    },
                    "status": {
                      "enum": [
                        "open",
                        "resolved"
                      ]
                    },
                    "opening": {
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "resolution": {
                      "type": [
                        "object",
                        "null"
                      ]
                    }
                  }
                }
              },
              "sources": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  }
}
