---
title: "Search for flights, responses include Foresight data"
method: GET
path: "/foresight/flights/search/advanced"
tags: ["foresight"]
---

# Search for flights, responses include Foresight data

`GET /foresight/flights/search/advanced`

## Request

- Base URL: `https://aeroapi.flightaware.com/aeroapi`
- URL: `https://aeroapi.flightaware.com/aeroapi/foresight/flights/search/advanced`
- Auth: API key in header `x-apikey`
- TypeScript: <https://skmtc.dev/flightaware/apis/aeroapi/docs/foresight/flights/search/advanced/get.ts> (a function with typed inputs; its response is checked against the schema)

Returns currently or recently airborne flights based on geospatial
search parameters. If available, flights' predicted OOOI fields will be
set.

## Query parameters

- `query` string
- `max_pages` integer
- `cursor` string

## Response `200`

OK

- object
  - `links` object, nullable, required: Object containing links to related resources.
    - `next` string, uri-reference, required: A link to the next set of records in a collection.
  - `num_pages` integer, required: Number of pages returned
  - `flights` object[], required
    - `ident` string, required: Either the operator code followed by the flight number for the flight (for commercial flights) or the aircraft's registration (for general aviation).
    - `ident_icao` string, nullable: The ICAO operator code followed by the flight number for the flight (for commercial flights)
    - `ident_iata` string, nullable: The IATA operator code followed by the flight number for the flight (for commercial flights)
    - `fa_flight_id` string, required: Unique identifier assigned by FlightAware for this specific flight. If the flight is diverted, the new leg of the flight will have a duplicate fa_flight_id.
    - `origin` object, nullable, required: Information for this flight's origin airport.
      - `code` string, nullable, required: ICAO/IATA/LID code or string indicating the location where tracking of the flight began/ended for position-only flights.
      - `code_icao` string, nullable: ICAO code
      - `code_iata` string, nullable: IATA code
      - `code_lid` string, nullable: LID code
      - `timezone` string, nullable: Applicable timezone for the airport, in the TZ database format
      - `name` string, nullable: Common name of airport
      - `city` string, nullable: Closest city to the airport
      - `airport_info_url` string, uri-reference, nullable, required: The URL to more information about the airport. Will be null for position-only flights.
    - `destination` object, nullable, required: Information for this flight's destination airport.
      - `code` string, nullable, required: ICAO/IATA/LID code or string indicating the location where tracking of the flight began/ended for position-only flights.
      - `code_icao` string, nullable: ICAO code
      - `code_iata` string, nullable: IATA code
      - `code_lid` string, nullable: LID code
      - `timezone` string, nullable: Applicable timezone for the airport, in the TZ database format
      - `name` string, nullable: Common name of airport
      - `city` string, nullable: Closest city to the airport
      - `airport_info_url` string, uri-reference, nullable, required: The URL to more information about the airport. Will be null for position-only flights.
    - `waypoints` number[], required: Route waypoints as an array of alternating latitudes and longitudes.
    - `first_position_time` string, date-time, nullable, required: Timestamp of when the first position for this flight was received.
    - `last_position` object, nullable, required: Most recent position received for this flight.
      - `fa_flight_id` string, nullable, required: Unique identifier assigned by FlightAware to the flight with this position. This field is only populated by the `/flights/search/positions` (in other cases, the user will have already specified the fa_flight_id).
      - `altitude` integer, required: Aircraft altitude in hundreds of feet
      - `altitude_change` 'C' | 'D' | '-', required: C when the aircraft is climbing, D when descending, and - when the altitude is being maintained.
      - `groundspeed` integer, required: Most recent groundspeed (knots)
      - `heading` integer, nullable, required: Aircraft heading in degrees (0-360)
      - `latitude` number, required: Most recent latitude position
      - `longitude` number, required: Most recent longitude position
      - `timestamp` string, date-time, required: Time that position was received
      - `update_type` 'P' | 'O' | 'Z' | 'A' | 'M' | 'D' | 'X' | 'S' | 'null', nullable, required: P=projected, O=oceanic, Z=radar, A=ADS-B, M=multilateration, D=datalink, X=surface and near surface (ADS-B and ASDE-X), S=space-based
    - `bounding_box` number[], nullable, required: List of 4 coordinates representing the edges of a box that entirely contains this flight's positions. The order of the coordinates are the top, left, bottom, and right sides of the box.
    - `ident_prefix` string, nullable, required: A one or two character identifier prefix code (Common values: G or GG Medevac, L Lifeguard, A Air Taxi, H Heavy, M Medium).
    - `aircraft_type` string, nullable, required: Aircraft type will generally be ICAO code, but IATA code will be given when the ICAO code is not known.
    - `actual_off` string, date-time, nullable, required: Actual runway departure time.
    - `actual_on` string, date-time, nullable, required: Actual runway arrival time.
    - `foresight_predictions_available` boolean, required: Indicates if Foresight predictions are available for AeroAPI /foresight endpoints.
    - `predicted_out` string, date-time, nullable, required: Predicted time of gate departure event. Only available from /foresight endpoints.
    - `predicted_off` string, date-time, nullable, required: Predicted time of runway departure event. Only available from /foresight endpoints.
    - `predicted_on` string, date-time, nullable, required: Predicted time of runway arrival event. Only available from /foresight endpoints.
    - `predicted_in` string, date-time, nullable, required: Predicted time of gate arrival event. Only available from /foresight endpoints.
    - `predicted_out_source` 'null' | 'Foresight' | 'Historical Average', nullable, required: Source indicator of the predicted time of the gate departure event. Only available from /foresight endpoints.
    - `predicted_off_source` 'null' | 'Foresight' | 'Historical Average', nullable, required: Source indicator of the predicted time of the runway departure event. Only available from /foresight endpoints.
    - `predicted_on_source` 'null' | 'Foresight' | 'Historical Average', nullable, required: Source indicator of the predicted time of the runway arrival event. Only available from /foresight endpoints.
    - `predicted_in_source` 'null' | 'Foresight' | 'Historical Average', nullable, required: Source indicator of the predicted time of the gate arrival event. Only available from /foresight endpoints.
    - `predicted_taxi_out_duration` number, nullable, required: Predicted duration in seconds of gate departure event. Only available from /foresight endpoints.
    - `predicted_taxi_out_duration_source` 'null' | 'Foresight', nullable, required: Source indicator of the predicted duration of the gate departure event. Only available from /foresight endpoints.

## Other responses

- `400`: Incorrect parameter(s). Query may be incorrect.

---

[API](https://skmtc.dev/flightaware/apis/aeroapi.md) - [All operations](https://skmtc.dev/flightaware/apis/aeroapi/llms.txt) - [OpenAPI document](https://skmtc.dev/flightaware/apis/aeroapi/revisions/3023e7a0c54c?raw)
