---
title: "Search for flights using advanced syntax"
method: GET
path: "/flights/search/advanced"
tags: ["flights"]
---

# Search for flights using advanced syntax

`GET /flights/search/advanced`

## Request

- Base URL: `https://aeroapi.flightaware.com/aeroapi`
- URL: `https://aeroapi.flightaware.com/aeroapi/flights/search/advanced`
- Auth: API key in header `x-apikey`
- TypeScript: <https://skmtc.dev/flightaware/apis/aeroapi/docs/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.

Query parameters include a latitude/longitude box, aircraft ident with
wildcards, type with wildcards, prefix, origin airport,
destination airport, origin or destination airport, groundspeed, and
altitude. It takes search terms in a single string comprising of
{operator key value} elements and returns an array of flight
structures. Each search term must be enclosed in curly braces. Multiple
search terms can be combined in an implicit boolean "and" by separating
the terms with at least one space. This function only searches flight
data representing approximately the last 24 hours. Codeshares and
alternate idents are NOT searched when matching against the ident key.

The supported operators include (note that operators take different numbers of arguments):

* false - results must have the specified boolean key set to a value of false. Example: {false arrived}
* true - results must have the specified boolean key set to a value of true. Example: {true lifeguard}
* null - results must have the specified key set to a null value. Example: {null waypoints}
* notnull - results must have the specified key not set to a null value. Example: {notnull aircraftType}
* = - results must have a key that exactly matches the specified value. Example: {= aircraftType C172}
* != - results must have a key that must not match the specified value. Example: {!= prefix H}
* < - results must have a key that is lexicographically less-than a specified value. Example: {< arrivalTime 1276811040}
* \> - results must have a key that is lexicographically greater-than a specified value. Example: {> speed 500}
* <= - results must have a key that is lexicographically less-than-or-equal-to a specified value. Example: {<= alt 8000}
* \>= - results must have a key that is lexicographically greater-than-or-equal-to a specified value.
* match - results must have a key that matches against a case-insensitive wildcard pattern. Example: {match ident AAL*}
* notmatch - results must have a key that does not match against a case-insensitive wildcard pattern. Example: {notmatch aircraftType B76*}
* range - results must have a key that is numerically between the two specified values. Example: {range alt 8000 20000}
* in - results must have a key that exactly matches one of the specified values. Example: {in orig {KLAX KBUR KSNA KLGB}}
* orig_or_dest - results must have either the origin or destination key exactly match one of the specified values. Example: {orig_or_dest {KLAX KBUR KSNA KLGB}}
* airline - results will only include airline flight if the argument is 1, or will only include GA flights if the argument is 0. Example: {airline 1}
* aircraftType - results must have an aircraftType key that matches one of the specified case-insensitive wildcard patterns. Example: {aircraftType {B76* B77*}}
* ident - results must have an ident key that matches one of the specified case-insensitive wildcard patterns. Example: {ident {N123* N456* AAL* UAL*}}
* ident_or_reg - results must have an ident key or was known to be operated by an aircraft registration that matches one of the specified case-insensitive wildcard patterns. Example: {ident_or_reg {N123* N456* AAL* UAL*}}

The supported key names include (note that not all of these key names are returned in the result structure, and some have slightly different names):

* actualDepartureTime - Actual time of departure, or null if not departed yet. UNIX epoch timestamp seconds since 1970
* aircraftType - aircraft type ID (for example: B763)
* alt - altitude at last reported position (hundreds of feet or Flight Level)
* altChange - altitude change indication (for example: "C" if climbing, "D" if descending, and empty if it is level)
* arrivalTime - Actual time of arrival, or null if not arrived yet. UNIX epoch timestamp seconds since 1970
* arrived - true if the flight has arrived at its destination.
* cancelled - true if the flight has been cancelled. The meaning of cancellation is that the flight is no longer being tracked by FlightAware. There are a number of reasons a flight may be cancelled including cancellation by the airline, but that will not always be the case.
* cdt - Controlled Departure Time, set if there is a ground hold on the flight. UNIX epoch timestamp seconds since 1970
* clock - Time of last received position. UNIX epoch timestamp seconds since 1970
* cta - Controlled Time of Arrival, set if there is a ground hold on the flight. UNIX epoch timestamp seconds since 1970
* dest - ICAO airport code of destination (for example: KLAX)
* edt - Estimated Departure Time. Epoch timestamp seconds since 1970
* eta - Estimated Time of Arrival. Epoch timestamp seconds since 1970
* fdt - Field Departure Time. UNIX epoch timestamp seconds since 1970
* firstPositionTime - Time when first reported position was received, or 0 if no position has been received yet. Epoch timestamp seconds since 1970
* fixes - intersections and/or VORs along the route (for example: SLS AMERO ARTOM VODIR NOTOS ULAPA ACA NUXCO OLULA PERAS ALIPO UPN GDL KEDMA BRISA CUL PERTI CEN PPE ALTAR ASUTA JLI RONLD LAADY WYVIL OLDEE RAL PDZ ARNES BASET WELLZ CIVET)
* fp - unique identifier assigned by FlightAware for this flight, aka fa_flight_id.
* gs - ground speed at last reported position, in kts.
* heading - direction of travel at last reported position.
* hiLat - highest latitude travelled by flight.
* hiLon - highest longitude travelled by flight.
* ident - flight identifier or registration of aircraft.
* lastPositionTime - Time when last reported position was received, or 0 if no position has been received yet. Epoch timestamp seconds since 1970.
* lat - latitude of last reported position.
* lifeguard - true if a "lifeguard" rescue flight.
* lon - longitude of last reported position.
* lowLat - lowest latitude travelled by flight.
* lowLon - lowest longitude travelled by flight.
* ogta - Original Time of Arrival. UNIX epoch timestamp seconds since 1970
* ogtd - Original Time of Departure. UNIX epoch timestamp seconds since 1970
* orig - ICAO airport code of origin (for example: KIAH)
* physClass - physical class (for example: J is jet)
* prefix - A one or two character identifier prefix code (common values: G or GG Medevac, L Lifeguard, A Air Taxi, H Heavy, M Medium).
* speed - ground speed, in kts.
* status - Single letter code for current flight status, can be S Scheduled, F Filed, A Active, Z Completed, or X Cancelled.
* updateType - data source of last position (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).
* waypoints - all of the intersections and VORs comprising the route

## 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.

## Other responses

- `400`: Incorrect parameter(s). Id may be missing or may not be fa_flight_id format.

---

[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)
