Skip to main content

Usage

Connection#

The following curl command connects to the Flights History endpoint, retrieves historic data for the specified ICAO address and prints the received data to the console.

The server will only send the flights between the desired dates and then stop the connection.

curl -H "Authorization: Bearer <your_token>" "https://api.airsafe.spire.com/v2/flights/history?start=2024-08-06T03:44:11.796Z&end=2024-08-06T04:44:11.796Z&icao_address=896497"
info

Query parameters start and end are mandatory in order to retrieve data.

Query Parameters#

The following parameters can be specified to retrieve real-time data with more accuracy.

Query ParametersTypeDescription
startdatetimeRequired - History data extraction start timestamp (ISO 8601 format)
enddatetimeRequired - History data extraction end timestamp (ISO 8601 format)
flight_idIDSpire internal unique flight ID
icao_addressstringHexadecimal representation of ICAO 24 – bit address
callsignstringCall sign
flight_numberstringFlight number (IATA format)
tail_numberstringAircraft registration
aircraft_typestringIATA/ICAO aircraft type code
aircraft_rolestringAircraft role e.g. PAX
airlinestringIATA/ICAO airline code
departure_airportstringIATA/ICAO departure airport code
arrival_airportstringIATA/ICAO arrival airport code
operating_airportstringIATA/ICAO airport code for all inbound and outbound flights
flight_statestringFlight state as one of "ON_GROUND","AIRBORNE","LANDED","POST_FLIGHT"
page_cursorstringPage cursor to retrieve data from following pages

Pagination#

Pagination is enforced in this endpoint. Whenever a next page is available, you will receive a cursor in the pagination object. Subsequent request should include a page_cursor=<previous_cursor_value> as a query parameter.

Pagination output sample#

An example pagination response with next page(s) available:

{
...
"pagination": {
"total_count": 15000,
"count": 10000,
"cursor": "MTY3NTEyOT...jI4Yzg5NA"
}
}

An example request to retrieve data from next page:

curl -H "Authorization: Bearer <your_token>" "https://api.airsafe.spire.com/v2/flights/history?start=<start>&end=<end>&page_cursor=MTY3NTEyOT...jI4Yzg5NA"