FlightRadarAPI
Unofficial SDK for FlightRadar24 written in JavaScript with NodeJS.
If you want to use the data collected using this SDK commercially, you need to subscribe to the Business plan.
See more information at: https://www.flightradar24.com/terms-and-conditions
Installing FlightRadarAPI:
npm install flightradarapi
Basic Usage:
Import the class FlightRadar24API
and create an instance of it.
const { FlightRadar24API } = require("flightradarapi");
const frApi = new FlightRadar24API();
Getting flights list:
let flights = await frApi.getFlights(...);
Getting airports list:
let airports = await frApi.getAirports(...);
Getting airlines list:
let airlines = await frApi.getAirlines();
Getting zones list:
let zones = await frApi.getZones();
Getting flight and airport details
You can also get more information about a specific flight such as: estimated time, trail, aircraft details, etc.
let flightDetails = await frApi.getFlightDetails(flight);
flight.setFlightDetails(flightDetails);
console.log("Flying to", flight.destinationAirportName);
Or get more information about a specific airport such as: runways, weather, arrived flights, etc.
let airportDetails = await frApi.getAirportDetails(icao);
Arrivals and departures can have a limit flightLimit
(max value is 100) to display. When you need to reach more than 100 flights you can use additional parameter page
to view other pages.
Get flights above your position:
The getBoundsByPoint(...)
method has parameters latitude
and longitude
for your position and radius
for the distance in meters from your position to designate a tracking area.
let bounds = frApi.getBoundsByPoint(52.567967, 13.282644, 2000);
let flights = await frApi.getFlights(null, bounds);
Filtering flights and airports:
The getFlights(...)
method has some parameters to search for flights by: area line, bounds (customized coordinates
or obtained by the getZones()
method), aircraft registration or aircraft type. See the example below:
let airlineIcao = "UAE";
let aircraftType = "B77W";
let zone = (await frApi.getZones())["northamerica"];
let bounds = frApi.getBounds(zone);
let emiratesFlights = await frApi.getFlights(
airlineIcao,
bounds,
null,
aircraftType,
);
There are more configurations that you may set by using the setFlightTrackerConfig(...)
method. See the method documentation
for more information.
Getting airport by ICAO or IATA:
let luklaAirport = await frApi.getAirport("VNLK", true);
Getting the distance between flights and airports:
The Flight
and Airport
classes inherit from Entity
, which contains the getDistanceFrom(...)
method. That method
returns the distance between the self instance and another entity in kilometers. Example:
let airport = await frApi.getAirport("KJFK");
let distance = flight.getDistanceFrom(airport);
console.log("The flight is", distance, "km away from the airport.");
Downloading Flight Data
Note: This requires a premium subscription and for you to be logged in.
let historyData = await frApi.getHistoryData(flight, "csv", 1706529600);
const buffer = Buffer.from(historyData);
fs.writeFile("history_data.csv", buffer);
flight_id
- The ID of the flight. Can be gotten from any other function that returns flight details.
file_type
- Either CSV or KML.
time
- The STD/scheduled time of deperature in UTC of the flight as a Unix timestamp. Putting an invalid time will return a blank document.
Setting and getting Real-time Flight Tracker parameters:
Set it by using the setFlightTrackerConfig(...)
method. It receives a FlightTrackerConfig
dataclass instance, but
you can also use keyword arguments directly to the method.
Get the current configuration with the getFlightTrackerConfig()
method, that returns a FlightTrackerConfig
instance. Note: creating a new FlightTrackerConfig
instance means resetting all parameters to default.
let flightTracker = frApi.getFlightTrackerConfig();
flightTracker.limit = 10
frApi.setFlightTrackerConfig(flightTracker, ...);
let flights = await frApi.getFlights(...);