CLI reference¶
The Pyfr24 command-line interface provides quick access to all features without writing code.
Common options¶
These options are available for all commands:
-t, --token: API token (can also be set via FLIGHTRADAR_API_KEY env var)-l, --log-level: Logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)-f, --log-file: Log file path-o, --output: Output file path (JSON)
Available commands¶
Flight summary¶
Get flight summary information:
# Short form
pyfr24 flight-summary -F F94371 -f "2025-04-18" -t "2025-04-18"
# Long form
pyfr24 flight-summary --flight F94371 --from-date "2025-04-18" --to-date "2025-04-18"
# Example response:
{
"data": [
{
"fr24_id": "39f406c4",
"flight": "F94371",
"callsign": "FFT4371",
"operating_as": "FFT",
"painted_as": "FFT",
"type": "A20N",
"reg": "N390FR",
"orig_icao": "KDEN",
"datetime_takeoff": "2025-04-18T16:25:31Z",
"dest_icao": "KSNA",
"dest_icao_actual": "KSNA",
"datetime_landed": "2025-04-18T18:26:53Z",
"hex": "A48356",
"first_seen": "2025-04-18T16:05:23Z",
"last_seen": "2025-04-18T18:27:52Z",
"flight_ended": false
}
]
}
Live flights¶
Get live flights for an aircraft registration:
Flight tracks¶
Get flight tracks by ID:
Export flight data¶
Export flight data with various options:
# Basic export
pyfr24 export-flight -i 39a84c3c -o data/flight_39a84c3c
# With different background maps
pyfr24 export-flight -i 39a84c3c --background carto-light # CartoDB Light (default)
pyfr24 export-flight -i 39a84c3c --background carto-dark # CartoDB Dark
pyfr24 export-flight -i 39a84c3c --background osm # OpenStreetMap
pyfr24 export-flight -i 39a84c3c --background esri-topo # ESRI World TopoMap
pyfr24 export-flight -i 39a84c3c --background esri-satellite # ESRI World Imagery
# With different orientations
pyfr24 export-flight -i 39a84c3c --orientation horizontal # 16:9 aspect ratio
pyfr24 export-flight -i 39a84c3c --orientation vertical # 9:16 aspect ratio
pyfr24 export-flight -i 39a84c3c --orientation auto # Auto-detect
# With timezone conversion
pyfr24 export-flight -i 39a84c3c --timezone "America/New_York" # Eastern Time
pyfr24 export-flight -i 39a84c3c --timezone "America/Los_Angeles" # Pacific Time
pyfr24 export-flight -i 39a84c3c --timezone "Europe/London" # GMT/BST
Airline information¶
Get airline information by ICAO code:
Airport information¶
Get airport information by code:
Flight positions¶
Get flight positions within a bounding box:
# Short form
pyfr24 flight-positions -b "33.5,-118.8,34.5,-117.5"
# Long form
pyfr24 flight-positions --bounds "33.5,-118.8,34.5,-117.5"
Flight IDs¶
Get flight IDs for an aircraft registration:
# Basic usage
pyfr24 flight-ids -R N216MH -f "2025-01-01" -t "2025-04-10"
# Save results to file
pyfr24 flight-ids -R N216MH -f "2025-01-01" -t "2025-04-10" -o flight_ids.json
Smart export¶
The smart-export command lets you export all data for a flight by flight number and date, with interactive selection if there are multiple matches.
Example:
- If multiple flights are found, you'll see a summary and be prompted to select.
- The output directory is named automatically for clarity.
- A
toplines.jsonfile is created with a summary of the exported flight.
Arguments:
--flight(required): Flight number or callsign--date(required): Date (YYYY-MM-DD)--output-dir: Custom output directory (optional)--background: Map background (carto-light, carto-dark, osm, esri-topo, esri-satellite)--orientation: Chart orientation (horizontal, vertical, auto)--timezone: Convert timestamps to specified timezone (e.g., America/New_York)--auto-select: For scripting (e.g.,latest,earliest, or index)
Toplines summary example:
{
"flight_number": "UA2151",
"flight_id": "3a01b036",
"date": "2025-04-22",
"origin": "KEWR",
"destination": "KDEN",
"departure_time": "2025-04-22T14:48:36Z",
"arrival_time": "2025-04-22T18:53:23Z",
"departure_time_readable": "April 22, 2025, at 2:48 p.m. UTC",
"arrival_time_readable": "April 22, 2025, at 6:53 p.m. UTC",
"registration": "N28457",
"aircraft_type": "B739"
}
With timezone conversion (--timezone "America/New_York"):
{
"flight_number": "UA2151",
"flight_id": "3a01b036",
"date": "2025-04-22",
"origin": "KEWR",
"destination": "KDEN",
"departure_time": "2025-04-22T10:48:36-04:00",
"arrival_time": "2025-04-22T14:53:23-04:00",
"departure_time_readable": "April 22, 2025, at 10:48 a.m. ET",
"arrival_time_readable": "April 22, 2025, at 2:53 p.m. ET",
"registration": "N28457",
"aircraft_type": "B739"
}
Getting help¶
For detailed help on any command: