The World’s Best Query-Based Flight Tracking and Flight Status API
AeroAPI® (formerly FlightXML) delivers customized access to developers seeking data from millions of flight status inputs for any application using REST/JSON.
AeroAPI® (formerly FlightXML) delivers customized access to developers seeking data from millions of flight status inputs for any application using REST/JSON.
AeroAPI is a simple, query-based API that gives software developers access to a variety of FlightAware's flight data. Users can obtain current or historical data. AeroAPI is a RESTful API delivering accurate and actionable aviation data. With the introduction of FlightAware Foresight, customers have access to the data that powers over half of the predictive airline ETAs in the US.
import requests
apiKey = input("API Key: ")
apiUrl = "https://aeroapi.flightaware.com/aeroapi/"
airport = 'KSFO'
payload = {'max_pages': 2}
auth_header = {'x-apikey':apiKey}
response = requests.get(apiUrl + f"airports/{airport}/flights",
params=payload, headers=auth_header)
if response.status_code == 200:
print(response.json())
else:
print("Error executing request")
String YOUR_API_KEY = "API_KEY_HERE";
String apiUrl = "https://aeroapi.flightaware.com/aeroapi/";
String airport = "KSFO";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(apiUrl + "airports/" + airport + "/flights"))
.headers("x-apikey", YOUR_API_KEY)
.build();
HttpResponse<String> response = client.send(request, BodyHandlers.ofString());
if (response.statusCode() == 200) {
System.out.println("responseBody: " + response.body());
}
<?php
$apiKey = "YOUR_API_KEY";
$fxmlUrl = "https://aeroapi.flightaware.com/aeroapi/";
$ident = 'SWA45';
$queryParams = array(
'max_pages' => 2
);
$url = $fxmlUrl . 'flights/' . $ident . '?' . http_build_query($queryParams);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('x-apikey: ' . $apiKey));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
if ($result = curl_exec($ch)) {
curl_close($ch);
echo $result;
}
?>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace AeroApi4Sample
{
public class FlightsResult
{
public List<Flight> Flights { get; set; }
}
public class Flight
{
public string Ident { get; set; }
[JsonPropertyName("fa_flight_id")]
public string FaFlightId { get; set; }
[JsonPropertyName("scheduled_out")]
public DateTime ScheduledOut { get; set; }
[JsonPropertyName("actual_out")]
public DateTime? ActualOut { get; set; }
}
public class Program
{
static void Main( string[] args )
{
Console.Write( "API Key: " );
var strApiKey = Console.ReadLine();
Console.Write( "Ident to look up (e.g., UAL47): " );
var strIdentToLookUp = Console.ReadLine();
var flights = GetFlights( strApiKey, strIdentToLookUp ).Result;
if( flights == null )
{
return;
}
var nextFlightToDepart = flights.Where(
f => f.ActualOut == null
).OrderBy( f => f.ScheduledOut ).First();
Console.WriteLine(
string.Format(
"Next departure of {0} is {1} at {2}",
strIdentToLookUp,
nextFlightToDepart.FaFlightId,
nextFlightToDepart.ScheduledOut
)
);
}
private static async Task<List<Flight>> GetFlights( string strApiKey, string strIdent )
{
using( var client = new HttpClient() )
{
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue( "application/json" )
);
client.DefaultRequestHeaders.Add(
"x-apikey",
strApiKey
);
FlightsResult flightResult = null;
var response = await client.GetAsync(
"https://aeroapi.flightaware.com/aeroapi/flights/" + strIdent
);
var contentStream = await response.Content.ReadAsStreamAsync();
if( response.IsSuccessStatusCode )
{
flightResult = await JsonSerializer.DeserializeAsync<FlightsResult>(
contentStream,
new JsonSerializerOptions
{
PropertyNameCaseInsensitive = true
}
);
}
else
{
Console.Error.WriteLine( "API call failed: " + response );
return null;
}
return flightResult.Flights;
}
}
}
}
A single Query may return one-to-many results, dependent upon the type of call being made and the input parameters provided. For pricing purposes, a 'result set' is defined as 15 results (records). Pricing is per result set. Pricing is subject to change.
Note: The max_pages input parameter can be used to limit/control how many result sets will be returned, with one page being equivalent to one result set.
All Premium and Standard tier accounts are eligible for volume discounting. The first $1000 of usage per month is always billed at list price, followed by each incremental level of usage being discounted at a more generous level. For monthly usage above $64,000 the discount is set at 94% off, which will enable you to continue to grow your applications and take full advantage of new features with minimal variance in total monthly cost.
Please contact FlightAware for more information regarding additional discounting available with 3 or 4 year term commitments.
In general, you are charged once per query. However, for queries that may return multiple pages of results (defined as sets of up to 15 results), you will be charge for the total number of pages returned (calculated as the per-query fee times the number of pages returned). You can control the maximum number of pages returned by the API for one query. Please refer to the API documentation for details on how to set the "max_pages" parameter.
Existing customers can visit the AeroAPI portal to see accrued charges.
FlightAware's API for flight status, flight tracking and aviation data can be accessed via REST and the API can be accessed using any programming language.
Please visit our FAQ to find answers to general questions or check out our discussion forum for more in-depth information.