Alerts API provides access to webhook-based notifications about changes in flight details.
Subscriptions are initiated by a call to the Listen API to monitor flights by filter, they exist until they are removed by the Unlisten API.
APIs are needed if you need to notify users of changes in status, terminal, gate or arrival, estimated time, if there are delays at airports.
Usually, flight updates depend on many factors, and often airlines and airports publish this information in advance, but there are delays, usually 1-10 minutes, compared to what may be known on the displays directly at the airport.
Some data, such as departure gate, can only be known when the plane is parked at the gate, while other data, such as departure and arrival times, are calculated from aggregated flight data at departure and arrival airports.
https://airlabs.co/api/v9/listen?airline_iata=AA&flight_number=6&api_key={{params.api_key}}
Parameter | Description | |
---|---|---|
api_key |
required | Your API Key from acccount dashboard. |
webhook_url |
required | Specify your server url to receive incoming updates via the outgoing webhook. |
airline_iata |
optional | Listen changes by Airline IATA code. |
airline_icao |
optional | Listen changes by Airline ICAO code. |
flight_number |
optional | Listen changes by Flight number. |
dep_iata |
optional | Listen changes by Departure Airport IATA code. |
dep_icao |
optional | Listen changes by Departure Airport ICAO code. |
dep_date |
optional | Listen changes by Departure Date (YYYY-MM-DD). |
dep_time |
optional | Listen changes by Departure Time (HH:mm:ss). |
arr_iata |
optional | Listen changes by Arrival Airport IATA code. |
arr_icao |
optional | Listen changes by Arrival Airport ICAO code. |
arr_date |
optional | Listen changes by Arrival Date (YYYY-MM-DD). |
arr_time |
optional | Listen changes by Arrival Time (HH:mm:ss). |
_fields |
optional | Fields to listen changes - dep_terminal, dep_gate, dep_estimated, arr_terminal, arr_gate, arr_baggage, arr_estimated, status, duration, dep_delayed, arr_delayed, arr_iata, arr_icao (comma-separated) or leave empty to listen all changes (by default). |
{
"listener_id": 99
}
Parameter | Description |
---|---|
listener_id |
The ID of the created listener. |
To delete a previously created listener by ID.
https://airlabs.co/api/v9/unlisten?listener_id=99&api_key={{params.api_key}}
Parameter | Description | |
---|---|---|
api_key |
required | Your API Key from acccount dashboard. |
listener_id |
required | ID of previously created listener |
{
"unlistened": true
}
To retrieve all previously created listeners.
https://airlabs.co/api/v9/listeners?api_key={{params.api_key}}
Example of webhook data sent to your server url, provided in listen request as webhook_url
For detailed field descriptions, please follow the Schedules API description.
{
"listener_id" : 4397,
"changed" : [
"dep_terminal","dep_gate","dep_estimated",
"arr_iata","arr_icao","arr_terminal","arr_gate","arr_estimated",
"arr_baggage","status","dep_delayed","arr_delayed"
],
"flight" : {
"airline_iata" : "AA",
"airline_icao" : "AAL",
"flight_number" : "1",
"flight_icao" : "AAL1",
"flight_iata" : "AA1",
"status" : "active",
"duration" : 370,
"delayed": 2, /* deprecated */
"dep_delayed": null,
"arr_delayed": 2,
"dep_iata" : "JFK",
"dep_icao" : "KJFK",
"dep_terminal" : "8",
"dep_gate" : "39",
"dep_time" : "2021-08-12 08:00",
"dep_time_utc" : "2021-08-12 12:00",
"arr_iata" : "LAX",
"arr_icao" : "KLAX",
"arr_terminal" : "4",
"arr_gate" : "46C",
"arr_baggage" : "T4C1",
"arr_time" : "2021-08-12 11:10",
"arr_time_utc" : "2021-08-12 18:10",
"arr_estimated" : "2021-08-12 11:12",
"arr_estimated_utc" : "2021-08-12 18:12"
}
}
To see the history of webhooks sent to your server, use the Webhooks method
https://airlabs.co/api/v9/webhooks?api_key={{params.api_key}}&days=10
{
"listener_id" : 4397,
"webhook_id" : 2561416,
"webhook_url" : "https://dev.example.domain/bot_hook",
"created" : "2023-03-02",
"performed" : "2023-03-02",
"res_status" : 200,
"res_headers" : {
"server" : "nginx/1.18.0 (Ubuntu)",
"date" : "Thu, 02 Mar 2023 16:44:12 GMT",
"content-type" : "application/json",
"content-length" : "42",
"connection" : "close",
"vary" : "Accept",
"allow" : "OPTIONS, POST",
"x-frame-options" : "DENY",
"x-content-type-options" : "nosniff",
"referrer-policy" : "same-origin",
"cross-origin-opener-policy" : "same-origin"
},
"changed" : [
"dep_terminal","dep_gate","dep_estimated",
"arr_iata","arr_icao","arr_terminal","arr_gate","arr_estimated",
"arr_baggage","status","dep_delayed","arr_delayed"
],
"flight" : {
"airline_iata" : "AA",
"airline_icao" : "AAL",
"flight_number" : "1",
"flight_icao" : "AAL1",
"flight_iata" : "AA1",
"status" : "active",
"duration" : 370,
"delayed": 2, /* deprecated */
"dep_delayed": null,
"arr_delayed": 2,
"dep_iata" : "JFK",
"dep_icao" : "KJFK",
"dep_terminal" : "8",
"dep_gate" : "39",
"dep_time" : "2021-08-12 08:00",
"dep_time_utc" : "2021-08-12 12:00",
"arr_iata" : "LAX",
"arr_icao" : "KLAX",
"arr_terminal" : "4",
"arr_gate" : "46C",
"arr_baggage" : "T4C1",
"arr_time" : "2021-08-12 11:10",
"arr_time_utc" : "2021-08-12 18:10",
"arr_estimated" : "2021-08-12 11:12",
"arr_estimated_utc" : "2021-08-12 18:12"
}
}