Want the latest version of AeroAPI?

Important update: You have reached documentation for AeroAPI version 2 (FlightXML2), which will reach end-of-life October 2023. If you are currently using this version, please make plans to migrate to version 4 in the near future.

We recently introduced AeroAPI v4, FlightAware's next-generation RESTful API for accessing comprehensive flight data. Offering a more advanced and easier to use platform!

  • RESTful/JSON - following latest standards and open API 3.1 specifications
  • Enhanced flight information and deeper data content
  • Comprehensive interactive online developer documentation
  • Foresight predictions now available

AeroAPI (formerly FlightXML) 2 Documentation


Using AeroAPI, programs can query the FlightAware live flight information and recent history datasets.

Queries for in-flight aircraft return a set of matching aircraft based on a combination of location, flight or tail number, origin and/or destination airport, aircraft type, and/or a low-to-high range of altitude and/or ground speed, among others. For each matching aircraft, data returned includes the flight or tail number, the aircraft type, origin and destination, time the last position was received, and the longitude, latitude, groundspeed, and altitude of that position. Matching flights' flight tracks can be requested as well.

For airports, AeroAPI queries can return a list of scheduled flights, flights that have departed, flights that are enroute to the airport, and flights that have arrived at the airport.

Example Applications

Possible uses of AeroAPI include:

  • Integrate AeroAPI radar data with your existing flight operations software.
  • Use AeroAPI in mobile apps for flight status or notifications.
  • Compile flight activity logs and records in your own database.
  • Create a customized alerting system based on the current status of your fleet.
  • Streamline flight planning by showing common routes as cleared by air traffic control between two airports.
  • Add real flight data to your simulations.
  • Show flight tracks in Google Earth.
  • Create visualizations of traffic patterns.
  • Add live flight information to your company's website.


To access AeroAPI 2, all requests must include a username and AeroAPI Key (don't have one?). This data is transmitted via the "basic" HTTP Authentication standard, which is sent to the AeroAPI server as a part of each HTTP request.

The web service libraries available in most programming languages allow you to directly specify a username and password as an argument for the request, so that the authentication is transparent to your application as it makes requests. However, with some libraries it may be necessary to manually encode the "user:key" in base64 and send the result in the "Authorization" header as part of each HTTP request.

If data security is a concern, all AeroAPI services are also available over SSL by simply substituting "https" as the protocol for any flightxml.flightaware.com URLs.

Web Services / SOAP / WSDL

The primary protocol recommended for use with AeroAPI 2 is the "Simple Object Access Protocol" (SOAP). Most modern SOAP implementations support use of "Web Services Description Language" (WSDL) definition file, which greatly simplifies accessing web services.

View: AeroAPI 2 WSDL XML

Although you can read the WSDL and generate SOAP queries manually, it is recommended that you develop your applications using a SOAP library that automatically parses the WSDL and populates your application namespace with the AeroAPI functions.

It is strongly suggested that you ensure that your applications cache the WSDL file so that it is not necessary to fetch and parse the WSDL for every request or instance of your application. This will vastly improve the performance and efficiency of your application.

The AeroAPI 2 WSDL uses the "Document/Literal wrapped" method for encoding SOAP requests and responses. This is a newer method that recent SOAP industry standards dictate should be used instead of the older "RPC/Encoded" method that was used by the AeroAPI 1 WSDL. Most modern SOAP client libraries fully support this newer method, although some older SOAP libraries are not yet compatible. The SOAP client libraries listed in the examples section have been tested to be compatible.


AeroAPI 2 can also be accessed using a light-weight "Representational state transfer" (REST) inspired protocol that returns its responses encoded in "JavaScript Object Notation" (JSON) format. This allows AeroAPI to be used in environments in which it is inconvenient or impossible to invoke SOAP services, such as mobile phone applications, web browser applications, or server-side JavaScript environments.

To access any method, simply perform either a GET or POST request to http://flightxml.flightaware.com/json/FlightXML2/METHODNAME using standard CGI-style representation of the arguments. All requests made must supply the username and API Key as a "basic" Authorization HTTP header.

For example, the following URL is how you might request the current weather at John F. Kennedy airport (KJFK) in New York: http://flightxml.flightaware.com/json/FlightXML2/MetarEx?airport=KJFK&startTime=0&howMany=1&offset=0

Requests can be returned in "JSONP" format, allowing a web page to load the response in a way that avoids the same-domain security restrictions enforced by some browsers. To do this, simply specify the optional argument "jsonp_callback" with a value that is the name of the JavaScript function that should be invoked with the JSON data.

Pushed Notifications

Although AeroAPI functionality is primarily intended to be accessed through a "pull" oriented request model using the SOAP/WSDL or REST/JSON interfaces, you can also opt to receive a "pushed" notification from our server to yours whenever certain flight events occur. Upon receiving a notification, your server-based application is sent basic information about the flight, its current status, and the triggering event. In response, your server-based application can initiate requests to AeroAPI using the normal SOAP/WSDL or REST/JSON interfaces to obtain additional details. This can allow your application to intelligently reduce or increase the rate at which it makes other AeroAPI requests at various parts of a flight, reducing your costs by avoiding unnecessary API requests during uneventful time periods.

To use pushed notifications, you must first call the "RegisterAlertEndpoint" method once to configure the URL endpoint where your server-based application can receive POST requests via HTTP or HTTPS. Once the URL endpoint has been registered, you can use the "SetAlert" method to define the triggering event conditions for the notifications that you want to receive.

When an event occurs, your URL endpoint will receive a POST request containing a JSON message. Although you can define alerts using either the SOAP/WSDL or REST/JSON interfaces, pushed notifications are always delivered in a JSON format. Delivery of each alert is attempted only once and is made on a best-effort policy. Your URL endpoint must accept the POST request and return a successful response within 5 seconds. It is recommended that your URL endpoint return a "Content-type" of "text/plain", and a short body (less than 32 characters) that acknowledges receipt of the pushed alert. If troubleshooting of alert delivery is required, the body responses for each delivered alert can be later reviewed on the Recently delivered alerts page. You can also use the AeroAPI Push Notification Testing Interface page to manually generate sample messages to be sent to your endpoint.

Show example (JSON push notification)...

			        "long_desc": "DAL116 arrived at KATL (Hartsfield-Jackson Intl) at 04:11PM EST from KTPA (Tampa Intl)",
			        "short_desc": "DAL116 arrived at KATL from KTPA",
			        "summary": "DAL116 arrived at KATL from KTPA",
			        "eventcode": "arrival",
			        "alert_id": 123456,
			        "flight": {
			                "ident": "DAL116",
			                "aircrafttype": "B752",
			                "origin": "KTPA",
			                "destination": "KATL",
			                "filed_ete": "01:15:00",
			                "route": "ENDED4 CTY HONIE8",
			                "faFlightID": "DAL116-1318311885-airline-0362",
			                "filed_altitude": 360,
			                "filed_airspeed_kts": 465,
			                "filed_time": 1318532269,
			                "filed_departuretime": 1318531500,
			                "estimatedarrivaltime": 1318536216,
			                "actualarrivaltime": 1318536660,
			                "actualdeparturetime": 1318532220

			        "long_desc": "Delta #1752 (DC95) has just filed a flight plan.  It is scheduled to depart from Jackson-Evers Intl (KJAN) at 01:05PM CST heading for Hartsfield-Jackson Intl (KATL) for an estimated arrival at 03:34PM EST.",
			        "short_desc": "DAL1752 (DC95) filed to depart KJAN @ 01:05PM CST for KATL @ ETA 03:34PM EST  (MEI LGC3)",
			        "summary": "DAL1752 filed a flight plan KJAN -> KATL",
			        "eventcode": "filed",
			        ...rest of sample omitted for brevity...

			        "long_desc": "Delta #116 (B752) departed Detroit Metro Wayne Co (KDTW) at 06:44PM UTC enroute to KATL (Hartsfield-Jackson Intl) for an estimated arrival at 08:30PM UTC",
			        "short_desc": "DAL116 (B752) departed KDTW @ 06:44PM UTC for KATL ETA 08:30PM UTC",
			        "summary": "DAL116 has departed KDTW for KATL",
			        "eventcode": "departure",
			        ...rest of sample omitted for brevity...
The description of the JSON attributes are as follows:
  • long_desc -- human-readable description of the event (sometimes longer than 80 characters). Not intended to be machine parsed, since this text is localized and the formatting is occasionally altered. (required)
  • short_desc -- human-readable description of the event (generally about 50 characters long). Not intended to be machine parsed, since this text is localized and the formatting is occasionally altered. (required)
  • summary -- human-readable summary of the event (generally about 20 characters long). Not intended to be machine parsed, since this text is localized and the formatting is occasionally altered. (required)
  • eventcode -- Indicates the type of event that has triggered this notification. May have one of the following values: (required)
    • filed -- details about an upcoming flight have been received (generally 1-2 hours before departure)
    • departure -- flight has departed from the origin (runway wheels-up or gate block-off)
    • arrival -- flight has arrived at destination (runway wheels-down or gate block-on)
    • cancelled -- flight has been cancelled prior to departure.
    • minutes_out -- flight is several minutes (usually 30-45 minutes) from its destination.
    • diverted -- flight has been diverted to another airport. To retrieve the new flight details, call FlightInfoEx to access the new flight by faFlightID or ident.
    • change -- some aspect of the flight plan has been modified, such as a departure time delay or a gate change.
  • alert_id -- Integer identifier of the alert that triggered the event. This is the value returned by SetAlert, and can be used with DeleteAlert to stop receiving notifications. (required)
  • flight -- Nested array with more details about the flight. Due to technical data limitations, some of these nested values (such as the actualarrivaltime and actualdeparturetime) may not yet be available for the latest event that is being alerted, but a subsequent call to FlightInfoEx might. Description of the nested values:
    • ident -- Operating identifier or registration for the aircraft (required)
    • aircrafttype -- Type of aircraft, if known (optional)
    • origin -- Origin airport, if known (optional)
    • destination -- Destination airport, if known (optional)
    • filed_ete -- Scheduled flight duration, if known (optional)
    • route -- Filed route waypoints, if known (optional)
    • faFlightID -- Unique FlightAware identifier for the flight, which can be used for FlightInfoEx or other methods (required)
    • filed_altitude -- Altitude of the flight plan, if known (optional)
    • filed_airspeed_kts -- Airspeed of the flight plan, in knots if known (optional)
    • filed_time -- Timestamp of when the flight plan was initially filed, in UNIX epoch seconds since 1970. (required)
    • filed_departuretime -- Scheduled flight departure time from origin, in UNIX epoch seconds since 1970. (required)
    • estimatedarrivaltime -- Estimated arrival time at destination, in UNIX epoch seconds since 1970. May be zero or absent if not known. (optional)
    • actualarrivaltime -- Actual time of arrival at destination, in UNIX epoch seconds since 1970. May be zero or absent if the flight has not yet arrived or the time is not yet known. (optional)
    • actualdeparturetime -- Actualtime of departure from origin, in UNIX epoch seconds since 1970. May be zero or absent if the flight has not yet departed or the time is not yet known. (optional)

Start building a great new aviation app with AeroAPI 2.

Examples (SOAP / WSDL)

Microsoft .NET

Show example (Visual Studio C#)...

Any Microsoft CLR .NET language should be usable to make requests to FlightXML 2.0, however this example is using C#. The procedure for using other languages may vary slightly. For this example we used Visual Studio 2017 but the same process should work for Visual Studio 2013 or newer.

  • Microsoft Visual Studio 2013 or newer

Example Steps

This example will step through creating a unit test in Visual Studio 2017 that queries FlightXML2 and writes the results out to the console. It is meant to give an overall view of the requirements so that you can adopt this to your own project.

  • Create a new Visual Studio project (File -> New -> Project...)
  • Select the Unit Test Project template (Templates -> Visual C# -> Test)
  • Inside your Visual Studio project, on the Solution Explorer panel, right click on the project's References and select 'Add Service Reference...'.
  • Input the URL for the FlightXML web service (https://flightxml.flightaware.com/soap/FlightXML2/wsdl) in the Address box and click the "GO" button. When prompted for your credentials, click 'Yes' and enter your username and apiKey.
  • Change the Namespace as desired and click "OK". We are using Namespace 'FlightXML2' for this example.
  • Open your app.config configuration file and add the change the binding section under basicHttpBinding to match the following (this add 'Basic' authenticaiton to the request headers). You may also need to change the endpoint to 'https'. In a real application this configuration might be stored somewhere other than app.config.:
    <?xml version="1.0" encoding="utf-8" ?>
            <binding name="FlightXML2Soap">
              <security mode="Transport">
                <transport clientCredentialType="Basic" />
          <endpoint address="https://flightxml.flightaware.com/soap/FlightXML2/op"
                binding="basicHttpBinding" bindingConfiguration="FlightXML2Soap"
                contract="FlightXML2.FlightXML2Soap" name="FlightXML2Soap" />

Here are the contents of our UnitTest1.cs file that connects to FlightXML2 to retrieve Enroute flights for Houston Hobby and METAR info for Austin.

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using fxmltext.FlightXML2;

namespace fxmltext
  public class UnitTest1
    public void TestMethod1()
      FlightXML2SoapClient client = new FlightXML2SoapClient();
      client.ClientCredentials.UserName.UserName = "sampleUser";
      client.ClientCredentials.UserName.Password = "abc123abc123abc123abc123abc123";

      EnrouteStruct r = client.Enroute("KHOU", 10, "", 0);
      foreach(EnrouteFlightStruct e in r.enroute)

Show example (CLI C#)...

Any Microsoft CLR .NET language should be usable to make requests to FlightXML 2.0, however this example is using C#. The procedure for using other languages may vary slightly. The steps described here use the command-line utilities to generate the WSDL stub and compile, but the steps can be adapted for use within the Visual Studio IDE.

  • Microsoft Visual Studio 2003 or newer

Save the following file as test.cs, but substitute your actual username and API key:

using System.Net;
class test {
    public static void Main(string[] args)
        FlightXML2 df = new FlightXML2();
        df.Credentials = new NetworkCredential("sampleUser", "abc123abc123abc123abc123abc123");
        df.PreAuthenticate = true;

        // get the flights currently enroute.
        EnrouteStruct r = df.Enroute("KAUS", 10, "", 0);
        foreach (EnrouteFlightStruct e in r.enroute) {

        // get the weather.

Run commands:

wsdl.exe https://flightxml.flightaware.com/soap/FlightXML2/wsdl

csc.exe test.cs FlightXML2.cs



Show example (SoapClient)...

The built-in SoapClient provided in PHP5 supports modern Document/Literal SOAP services, like FlightXML2.

  • PHP5 or above
  • SoapClient
    • if building PHP from source, it must have been compiled with: ./configure --enable-soap
    • on Ubuntu or Debian based systems: sudo aptitude install php-soap
    • on RHEL/Fedora based systems: yum install php-soap

Save the following file as testsoap.php, but substitute your actual username and API key:


$options = array(
                 'trace' => true,
                 'exceptions' => 0,
                 'login' => 'sampleUser',
                 'password' => 'abc123abc123abc123abc123abc123abc123',
$client = new SoapClient('http://flightxml.flightaware.com/soap/FlightXML2/wsdl', $options);

// get the weather.
$params = array("airport" => "KAUS");
$result = $client->Metar($params);

Show example (nusoap)...

The NuSOAP toolkit for PHP can be used with FlightXML2.

  • PHP4 or PHP5
  • NuSOAP (tested with 0.7.3)
    • on RHEL/Fedora based systems: yum install php-nusoap
    • on FreeBSD systems: cd /usr/ports/net/nusoap && make install
    • otherwise download from the SourceForge project site listed above

Save the following file as testsoap.php, but substitute your actual username and API key:


require_once( "nusoap/nusoap.php" );

$username = 'sampleUser';
$apiKey = 'abc123abc123abc123abc123abc123abc123';

$baseUri = "http://flightxml.flightaware.com/soap/FlightXML2";

$client = new nusoap_client("$baseUri/wsdl",'wsdl');

if ( $client->getError() ) {
    die "Soap Constructor Error:" . $client->getError();

// get the weather.
$params = array("airport" => "KAUS");
$result = $client->call( "Metar", $params);
if ($client->fault) { //soap_fault
    die "Soap Fault: ". $client->faultcode . "(" . $client->faultstring . ")";
elseif ( $client->getError() ) {
    die "Soap Error: " . $client->getError();
else {



Show example (SOAP::WSDL)...

The Perl CPAN module SOAP::WSDL is a modern SOAP client that fully supports Document/Literal services.

  • Perl5 or above
  • SOAP::WSDL (tested with 2.00.10)
    • On FreeBSD systems: cd /usr/ports/devel/p5-SOAP-WSDL && make install
    • On RHEL/Fedora based systems: rpm -Uvh perl-SOAP-WSDL-2.00-xx-y.zz.rf.noarch.rpm (from the RPMForge repository)
    • Otherwise: perl -MCPAN -e 'install SOAP::WSDL'

Save the following file as testwsdl.pl, but substitute your actual username and API key:


use strict;
use SOAP::WSDL 2.0;

my $username = "sampleUser";
my $apiKey = "abc123abc123abc123abc123abc123";

my $baseUri = "http://flightxml.flightaware.com/soap/FlightXML2";

sub SOAP::WSDL::Transport::HTTP::get_basic_credentials {
    return $username => $apiKey;
sub SOAP::Transport::HTTP::Client::get_basic_credentials {
    return $username => $apiKey;

# Check if the SOAP result is an exception.
sub is_fault ($) {
    my $result = shift;
    return !defined($result) || ref($result) eq 'SOAP::Fault' || !defined($result->result);

# Singleton arrays are changed by SOAP::WSDL into scalars, making you handle either type.
sub coerce_arrayref ($) {
    my $val = shift;
    my @result = (ref($val) eq 'ARRAY' ? @$val : $val) if defined($val);
    return @result;

my $soap = SOAP::WSDL->new( wsdl => "$baseUri/wsdl" );

my $enroute = $soap->call('Enroute', EnrouteRequest => {'airport' => "KSMO", 'howMany' => 10, 'filter' => "", 'offset' => 0});
die if is_fault($enroute);

print "Aircraft en route to KSMO:\n";

my @flights = coerce_arrayref($enroute->result->{enroute});

foreach my $flight (@flights) {
   print $flight->{'ident'} . " (" . $flight->{'aircrafttype'} . ") \t" .
       $flight->{'originName'} . " (" . $flight->{'origin'} . ")\n";

Run commands:

Show example (SOAP::Lite)...

The Perl CPAN module SOAP::Lite is an old and well-known SOAP client for Perl, however it is not especially well-suited for modern "Document/Literal" SOAP services. However, it can be used if you are willing to make calls to explicitly declare the types of all function arguments using the SOAP::Data method. The "stubmaker.pl" utility and the SOAP::Lite WSDL support cannot be used.

  • Perl5 or above
  • SOAP::Lite (tested with 0.710.10)
    • On RHEL/Fedora based systems: yum install perl-SOAP-Lite
    • On FreeBSD systems: cd /usr/ports/net/p5-SOAP-Lite && make install
    • Otherwise: perl -MCPAN -e 'install SOAP::Lite'

Save the following file as testlite.pl, but substitute your actual username and API key:


use strict;
use SOAP::Lite;

my $username = "sampleUser";
my $apiKey = "abc123abc123abc123abc123abc123";

my $baseUri = "http://flightxml.flightaware.com/soap/FlightXML2";

sub SOAP::Transport::HTTP::Client::get_basic_credentials {
    return $username => $apiKey;

my $soap = SOAP::Lite->default_ns($baseUri)->proxy("$baseUri/op")->autotype(0);

my $enroute = $soap->call("Enroute",
    SOAP::Data->name("airport" => 'KSMO'),
    SOAP::Data->name("howMany" => 10),
    SOAP::Data->name("filter" => ''),
    SOAP::Data->name("offset" => 0)
die if !defined($enroute) || $enroute->fault;

print "Aircraft en route to KSMO:\n";
my $flights = $enroute->result->{enroute};
foreach my $flight (@$flights) {
   print $flight->{'ident'} . " (" . $flight->{'aircrafttype'} . ") \t" .
       $flight->{'originName'} . " (" . $flight->{'origin'} . ")\n";

Run commands:



Show example (Apache Axis1)...


Save the following file as test.java, but substitute your actual username and API key:

import com.flightaware.flightxml.soap.FlightXML2.*;

class test {
    public static void main(String[] args)
        try {
            FlightXML2Locator locator = new FlightXML2Locator();
            FlightXML2Soap df = locator.getFlightXML2Soap();
            FlightXML2SoapStub stub = (FlightXML2SoapStub)df;

            // Get the list of enroute aircraft.
            EnrouteStruct r = df.enroute(new EnrouteRequest("KAUS", 10, "", 0)).getEnrouteResult();
            for (EnrouteFlightStruct e: r.getEnroute()) {

            // Get the weather.
            System.out.println(df.metar(new MetarRequest("KAUS")).getMetarResult());
        } catch (javax.xml.rpc.ServiceException x) {
        } catch (java.rmi.RemoteException x) {


Run commands (Win32):

set CLASSPATH=axis-1_4\lib\axis-ant.jar;axis-1_4\lib\axis.jar;axis-1_4\lib\commons-discovery-0.2.jar;

wget -O wsdl2.xml http://flightxml.flightaware.com/soap/FlightXML2/wsdl

java org.apache.axis2.wsdl.WSDL2Java wsdl2.xml

javac test.java

java test
Show example (Apache Axis2)...


Save the following file as test2.java, but substitute your actual username and API key:

import org.apache.axis2.transport.http.*;
import org.apache.axis2.transport.http.impl.httpclient4.HttpTransportPropertiesImpl;
import com.flightaware.flightxml.soap.flightxml2.*;

class test2 {
    public static void main(String[] args)
        try {
            HTTPAuthenticator auth = new HttpTransportPropertiesImpl.Authenticator();

            FlightXML2Stub stub = new FlightXML2Stub();
            stub._getServiceClient().getOptions().setProperty(HTTPConstants.CHUNKED, false);
            stub._getServiceClient().getOptions().setProperty(HTTPConstants.AUTHENTICATE, auth);

            // Get the list of enroute aircraft.
            EnrouteRequest req1 = new EnrouteRequest();

            EnrouteRequestE req1e = new EnrouteRequestE();
            for (EnrouteFlightStruct e: 
                    stub.enroute(req1e).getEnrouteResults().getEnrouteResult().getEnroute()) {
                System.out.println(e.getIdent() + " (" + e.getAircrafttype() + ") \t" + 
                       e.getOriginName() + " (" + e.getOrigin() + ")");

            // Get the weather.
            MetarRequest req2 = new MetarRequest();
            MetarRequestE req2e = new MetarRequestE();

        } catch (java.rmi.RemoteException x) {

Run commands (UNIX):

export CLASSPATH=$(echo . axis2-1.7.4/lib/*.jar | tr ' ' ':')

./axis2-1.7.4/bin/wsdl2java.sh -S . -uri http://flightxml.flightaware.com/soap/FlightXML2/wsdl

javac test2.java

java test2
Show example (NetBeans)...


Steps to start developing a JAX-WS Web Service Client in NetBeans

  1. Create Project and Class
    • New Project -> Java Application -> Click Next -> Name the Project (for this example I will calle it MyFlightXML), Optionally change location and folder) -> Click Finish

  2. Add the WSDL
    • Right-click the node (MyFlightXML) and choose New -> Web Service Client -> Click "WSDL URL" and provide this link "https://flightxml.flightaware.com/soap/FlightXML2/wsdl", do not change "Package" -> Click Finish -> Accept the Certificate
    • Wait for the WSDL parsing. You should see all the names of all the generated java classes in the output window. The process should finish with "BUILD SUCCESSFUL"

  3. Inspect your resources
    • The URL of the WSDL that you used to create the client is mapped to the local copy of the WSDL which you can see under the main node, in jax-ws-catalog.xml
    • Within the Generated Sources node , you should see the client stubs that were generated by the JAX-WS Web Service Client wizard.
      By inspecting the stub names you should see that the stubs are generally grouped as "request", "result" and possibly "struct"

  4. Import the stubs you want
    • In your Java Class import the stubs you want from the Generated Sources. For example, to import all of them you would use a command similar to:
           import com.flightaware.flightxml.soap.flightxml2.*;
      Make sure that the package name matches yours! Sometimes it may be com.flightaware.flightxml.soap.FlightXML2.*


  • FlightXML2Soap.java stub will provide all the starting point methods. After selecting FlightXML2Soap.java from the Generated Sources you should see all the methods in the NetBeans Navigator window under Members.
  • All the methods take a request object and return a result object, both of which can be found in the Generated Resources as well.
    Therefore, you need to create a request, pass it to the FlightXML2Soap.java method you need and finally get all the information from the result object. Again, the Navigator window will show all methods available for each class and you can use these methods to get to a easily printable value that you want such as a String or an int.

Additional documentation on developing a JAX-WS Web Service Client in NetBeans can be found on netbeans.com:

Client Example

In order to have a working example, you need to substitute your actual username and API key in the Authenticator, in the new PasswordAuthentication("username", "key".toCharArray());.

import java.util.List;
import com.flightaware.flightxml.soap.flightxml2.*;
import java.net.Authenticator;
import java.net.MalformedURLException;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;

public class MyFlightXML {

public static void main(String[] args) {

    // The java.net.Authenticator class is used to enable authentication and to provide access to a store of usernames and passwords
    // which are then used in the respective authentication schemes. 
    //  When authentication is required, the system will invoke one of the requestPasswordAuthentication() methods
    //  which in turn will call the getPasswordAuthentication() method of the registered object. 
    Authenticator.setDefault(new Authenticator() {
        protected PasswordAuthentication getPasswordAuthentication() {
            return new PasswordAuthentication("username", "key".toCharArray());

    // Connect and authenticate
    FlightXML2 locator = new FlightXML2();
            //if you don't have wsdl already loaded:
            //String WSDL_URL = "https://flightxml.flightaware.com/soap/FlightXML2/wsdl";
            //URL wsdl_url = null;
            //try {
            //    wsdl_url = new URL(WSDL_URL);
            //} catch (MalformedURLException ex) {
            //   Logger.getLogger(MyFlightXML.class.getName()).log(Level.SEVERE, null, ex);
            //FlightXML2 locator = new FlightXML2(wsdl_url);
    // get the stub that provides the methods needed
    FlightXML2Soap df = locator.getFlightXML2Soap();

    // Get the list of enroute aircraft.
    System.out.println("\n---------- PRINT ENROUTE AIRCRAFT ----------\n");
    // set request first:
    EnrouteRequest enroute_req = new EnrouteRequest();
    // retrieve result of request
    EnrouteStruct struct = (df.enroute(enroute_req)).getEnrouteResult();
    for (EnrouteFlightStruct flight : struct.getEnroute()) {
        // print the ident; EnrouteFlightStruct offers many more methods
    // get the weather
    System.out.println("\n---------- PRINT WEATHER ----------\n");
    // set request first:
    MetarRequest weather_req = new MetarRequest();
    // retrieve result of request
    MetarResults weather = df.metar(weather_req);
    // show all airlines
    System.out.println("\n---------- PRINT ALL AIRLINES ----------\n");
    // set request first:
    AllAirlinesRequest all_airlines_req = new AllAirlinesRequest();
    // retrieve result of request
    AllAirlinesResults all_airlines_result = df.allAirlines(all_airlines_req);
    // use provided sequence of methods to get to the airline string
    ArrayOfString array = all_airlines_result.getAllAirlinesResult();
    List<String> list_all_airlines = array.getData();
    // walk the list result
    for (String airline : list_all_airlines) {


Show example (tclws)...

  • TCL 8.5
  • TCLws (tested with 1.3.0)

Save the following file as test.tcl, but substitute your actual username and API key:

#!/bin/env tclsh8.5

package require WS::Client 1.3.0
package require base64

# uncomment these lines for debugging output
#::log::lvChannelForall stderr
#foreach lev [::log::levels] { ::log::lvSuppress $lev 0 }

set username "sampleUser"
set apiKey "abc123abc123abc123abc123abc123"
set baseUri "http://flightxml.flightaware.com/soap/FlightXML2"

set wsdl [::WS::Client::GetAndParseWsdl "$baseUri/wsdl"]
set apiname [::WS::Client::LoadParsedWsdl $wsdl]
set authheader [list Authorization "Basic [::base64::encode $username:$apiKey]"]

proc get_weather {airport} {
    global apiname authheader
    array set result [::WS::Client::DoCall $apiname Metar [list airport $airport] $authheader]

    puts "Weather for $airport:"
    puts $result(MetarResult)

proc get_flights {airport} {
    global apiname authheader
    array set result [::WS::Client::DoCall $apiname Enroute [list airport $airport howMany "10" fiter "" offset "0"] $authheader]
    array set flights $result(EnrouteResult)
    puts "Aircraft en route to $airport:"

    foreach flightdata $flights(enroute) {
        array unset flight
        array set flight $flightdata
        puts "$flight(ident) ($flight(aircrafttype)) $flight(originName) ($flight(origin))"

get_weather "KSMO"
get_flights "KSMO"

Run commands:

tclsh8.5 test.tcl


Show example (soapPy)...


Save the following file as test.py, but substitute your actual username and API key:

#!/usr/bin/env python

from SOAPpy import Config, HTTPTransport, SOAPAddress, WSDL

username = 'sampleuser'
apiKey = 'abc123abc123abc123abc123abc123abc123'
wsdlFile = 'http://flightxml.flightaware.com/soap/FlightXML2'

# This is a custom HTTP transport that allows Basic Authentication.
class myHTTPTransport(HTTPTransport):
	username = None
	passwd = None

	def setAuthentication(cls,u,p):
		cls.username = u
		cls.passwd = p

	def call(self, addr, data, namespace, soapaction=None, encoding=None,
		http_proxy=None, config=Config, timeout=None):

	if not isinstance(addr, SOAPAddress):
		addr=SOAPAddress(addr, config)

	if self.username != None:
		addr.user = self.username+":"+self.passwd

	return HTTPTransport.call(self, addr, data, namespace, soapaction,
								encoding, http_proxy, config)

# Make a FlightXML server request.
myHTTPTransport.setAuthentication(username, apiKey)
DF = WSDL.Proxy(wsdlFile, transport=myHTTPTransport)

enroute = DF.Enroute('KSMO',10,'',0)

flights = enroute['enroute']

print "Aircraft en route to KSMO:"
for flight in flights:
	print "%s (%s) \t%s (%s)" % ( flight['ident'], flight['aircrafttype'],
					flight['originName'], flight['origin'])

Run commands:

Show example (suds)...


Save the following file as test.py, but substitute your actual username and API key:


import sys
from suds import null, WebFault
from suds.client import Client
import logging

username = 'sampleUser'
apiKey = 'abc123abc123abc123abc123abc123abc123'
url = 'http://flightxml.flightaware.com/soap/FlightXML2/wsdl'

api = Client(url, username=username, password=apiKey)
#print api

# Get the weather
result = api.service.Metar('KAUS')
print result

# Get the flights enroute
result = api.service.Enroute('KSMO', 10, '', 0)
flights = result['enroute']

print "Aircraft en route to KSMO:"
for flight in flights:
    print "%s (%s) \t%s (%s)" % ( flight['ident'], flight['aircrafttype'],
                                  flight['originName'], flight['origin'])


Run commands:



Show example (soap4r)...

  • Ruby 1.8 or above
  • soap4r
    • For Ruby 1.8: gem install soap4r
    • For Ruby 1.9: gem install soap4r-ruby1.9
  • flightxml2-client-ruby

Save the following file as test.rb, but substitute your actual username and API key:

#!/usr/bin/env ruby
require 'FlightXML2Driver.rb'

username = 'sampleuser'
apiKey = 'abc123abc123abc123abc123abc123abc123'

$api = FlightXML2Soap.new(username, apiKey)

result = $api.enroute(EnrouteRequest.new('KSMO',10,'',0))

flights = result.enrouteResult.enroute

print "Aircraft en route to KSMO:\n"
flights.each { |flight|
    print "#{flight.ident} (#{flight.aircrafttype}) \t#{flight.originName} (#{flight.origin})\n"

Run commands:

Show example (savon)...

  • Ruby 1.8 or above
  • Heavy metal Ruby SOAP client library (savon): homepage, github
    • gem install savon

Save the following file as test.rb, but substitute your actual username and API key:

#!/usr/bin/env ruby

require 'rubygems'
require 'savon'

SOAP_URL = 'http://flightxml.flightaware.com/soap/FlightXML2/wsdl'
USERNAME = 'sampleuser'
API_KEY = 'abc123abc123abc123abc123abc123abc123'

client = Savon::Client.new do
  wsdl.document = SOAP_URL
  http.auth.basic USERNAME, API_KEY

result = client.request(:enroute) do
  soap.body = {
    :airport => 'KSMO',
    :how_many => 10,
    :filter => '',
    :offset => 0

flights = result.to_hash[:enroute_results][:enroute_result][:enroute]

print "Aircraft en route to KSMO:\n"
flights.each { |flight|
  print "#{flight[:ident]} (#{flight[:aircrafttype]}) \t#{flight[:origin_name]} (#{flight[:origin]})\n"

Run commands:



Show example (cfm)...
  • ColdFusion 8 or newer

Save the following file as test.cfm, but substitute your actual username and API key:

    stAuth = structNew();
    stAuth.username = "sampleuser";
    stAuth.password = "abc123abc123abc123abc123abc123abc123";
    ws = createObject("webservice", "http://flightxml.flightaware.com/soap/FlightXML2/wsdl", stAuth);

    stEnroute = structNew();
    stEnroute.airport = "KSFO";
    stEnroute.howMany = 15;
    stEnroute.filter = "";
    stEnroute.offset = 0;

    aEnrouteStruct = ws.Enroute(stEnroute);
<cfset EnrouteFlights = aEnrouteStruct.getEnrouteResult().getEnroute()>

<cfloop from="1" to="#ArrayLen(EnrouteFlights)#" index="i">
    <cfset dtime = DateAdd("s",EnrouteFlights[i].actualdeparturetime,DateConvert("utc2Local", "January 1 1970 00:00"))>
    <cfoutput>#EnrouteFlights[i].ident# = #EnrouteFlights[i].aircrafttype# departed at #dtime#<br></cfoutput>

Examples (REST / JSON)


Show example (Node.js)...

This example is a Node.JS console application written in Javascript that accesses FlightXML2 over its JSON interface.


Save the following file as test.js, but substitute your actual username and API key:

 * This requires: restler
 * To install, type 'npm install restler'
 * Tested with node.js v0.6.14

var util = require('util');
var restclient = require('restler');

var fxml_url = 'http://flightxml.flightaware.com/json/FlightXML2/';
var username = 'YOUR_USERNAME';
var apiKey = 'YOUR_APIKEY';

restclient.get(fxml_url + 'MetarEx', {
    username: username,
    password: apiKey,
    query: {airport: 'KAUS', howMany: 1}
}).on('success', function(result, response) {
    // util.puts(util.inspect(result, true, null));
    var entry = result.MetarExResult.metar[0];
    util.puts('The temperature at ' + entry.airport + ' is ' + entry.temp_air + 'C');

restclient.get(fxml_url + 'Enroute', {
    username: username,
    password: apiKey,
    query: {airport: 'KIAH', howMany: 10, filter: '', offset: 0}
}).on('success', function(result, response) {
    util.puts('Aircraft en route to KIAH:');
    //util.puts(util.inspect(result, true, null));
    var flights = result.EnrouteResult.enroute;
    for (i in flights) {
      var flight = flights[i];
      util.puts(flight.ident + ' (' + flight.aircrafttype + ')\t' + 
          flight.originName + ' (' + flight.origin + ')');


Run commands:

node test.js

Microsoft classic ASP

Show example (classic ASP)...

This example demonstrates how to access FlightXML2 over its JSON interface using classic ASP.


Save the following file as test.asp, but substitute your actual username and API key:

<script language="javascript" runat="server" src="json2.js"></script>
Dim postData, httpRequest, jsonResponse

postData = "airport=KAUS"
postData = postData & "&howMany=10"
postData = postData & "&filter=airline"

Set httpRequest = Server.CreateObject("MSXML2.ServerXMLHTTP")
httpRequest.Open "POST", "http://flightxml.flightaware.com/json/FlightXML2/Arrived", False, "YOUR_USERNAME", "YOUR_APIKEY"
httpRequest.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
httpRequest.Send postData

If httpRequest.status = 200 Then
    Set jsonResponse = JSON.parse(httpRequest.responseText)

    For Each flight In jsonResponse.ArrivedResult.arrivals
        Response.Write("Flight " & flight.ident & " is arriving from " & flight.origin & "<br>") 
    Response.Write("Error occurred")
End If

Set httpRequest = Nothing

Objective C

Show example (Objective C)...

This example demonstrates how to access FlightXML2 over its JSON interface using Objective C on Mac OS X.

  • Download and install Xcode from the Apple Store
  • File->New->Project->Command line tools (type choose Foundation)

Save the following file as test.m, but substitute your actual username and API key:

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[])
    @autoreleasepool {
        NSString* path = @"http://YOUR_USERNAME:[email protected]/json/FlightXML2/Enroute?airport=KSMO&filter=''&howMany=10&offset=0";
        NSMutableURLRequest* _request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:path]];
        [_request setHTTPMethod:@"GET"];
        NSURLResponse *response = nil;
        NSError *error = nil;
        NSData* _connectionData = [NSURLConnection sendSynchronousRequest:_request returningResponse:&response error:&error];
        if(nil != error)
            NSLog(@"Error: %@", error);
            NSMutableDictionary* json = nil;
            if(nil != _connectionData)
                json = [NSJSONSerialization JSONObjectWithData:_connectionData options:NSJSONReadingMutableContainers error:&error];
            if (error || !json)
                NSLog(@"Could not parse loaded json with error:%@", error);
                NSMutableDictionary *routeRes;
                routeRes = [json objectForKey:@"EnrouteResult"];
                NSMutableArray *res;
                res = [routeRes objectForKey:@"enroute"];
                for(NSMutableDictionary *flight in res)
                    NSLog(@"ident is %@, aircrafttype is %@, originName is %@, origin is %@", [flight objectForKey:@"ident"], [flight objectForKey:@"aircrafttype"], [flight objectForKey:@"originName"], [flight objectForKey:@"origin"]);
            _connectionData = nil;
    return 0;


Show example (Ruby)...

  • Ruby 1.9 or above
  • FlightXML2 JSON REST Client for Ruby by auzroz: github
    • gem install FlightXML2RESTDriver

Save the following file as test.rb, but substitute your actual username and API key:

#!/usr/bin/env ruby

require './FlightXML2RESTDriver.rb'
require './FlightXML2Rest.rb'

username = 'YourUserName'
apiKey = 'YourAPIKey'

# This provides the basis for all future calls to the API
test = FlightXML2REST.new(username, apiKey)

# Enroute
print "Aircraft en route to KSMO:\n"
result = test.Enroute(EnrouteRequest.new('KSMO', 'ga', 15, 0 ))
pp result.enrouteResult


Run commands:



The following list summarizes the functional changes between AeroAPI 1 and AeroAPI 2 to date:

  • (2010-06) Renamed METAR to Metar, TAF to Taf, NTAF to NTaf
  • (2010-06) Renamed MapFlight_Beta to MapFlight, countAirportOperations to CountAirportOperations, blockIdentCheck to BlockIdentCheck
  • (2010-06) Added FleetScheduled
  • (2010-06) Added CountAllEnrouteAirlineOperations
  • (2010-06) Added AllAirlines
  • (2010-06) Added AirlineInfo
  • (2010-06) Added beta DistressedAircraftDetector (since removed)
  • (2010-06) Added RoutesBetweenAirportsEx
  • (2010-06) Added GetHistoricalTrack
  • (2010-06) Added SetMaximumResultSize
  • (2010-06) Added MetarEx
  • (2010-06) Added SearchBirdseyeInFlight
  • (2010-06) Changed RoutesBetweenAirportsEx to return ArrayOfRoutesBetweenAirportsExStruct and add min/max altitude, last departure, next_offset
  • (2010-06) Added SearchBirdseyePositions
  • (2010-07) Added MapFlightEx
  • (2010-07) Added FlightInfoEx and GetFlightID
  • (2010-07) Removed beta DistressedAircraftDetector, which can be implemented in terms of SearchBirdseyeInFlight with "{!= physClass P} {> circles 3}"
  • (2010-07) Added DecodeFlightRoute and DecodeRoute
  • (2010-07) Changed GetHistoricalTrack to take faFlightID as argument
  • (2011-02) Added AirlineFlightInfo
  • (2011-02) Changed GetHistoricalTrack, DecodeFlightRoute, MapFlightEx, and AirlineFlightInfo to allow "ident@departureTime" syntax to optionally be used instead of a faFlightID, saving the need to explicitly use GetFlightID first.
  • (2011-02) Changed FlightInfo, FlightInfoEx, InFlightInfo, GetLastTrack, GetFlightID, TailOwner, and MapFlight to handle codeshare or alternate ident lookups automatically. GetHistoricalTrack, DecodeFlightRoute, MapFlightEx, and AirlineFlightInfo allow codeshare and alternte idents when using the "ident@departureTime" syntax.
  • (2011-03) Added AirlineFlightSchedules (since removed)
  • (2011-04) Removed AirlineFlightSchedules
  • (2011-05) Added AirlineInsight (since removed)
  • (2011-07) Added InboundFlightInfo. Enhanced SearchBirdseyeInFlight to add the special operators: orig_or_dest, airline, aircraftType, ident.
  • (2011-09) Introduced support for REST/JSON clients of all current AeroAPI 2 methods.
  • (2011-10) Introduced support for pushed AeroAPI flight alerts. Added GetAlerts, SetAlert, DeleteAlert, RegisterAlertEndpoint methods.
  • (2012-03) Added support for Australian airspace. To receive these flights, you must use the API key request page to obtain a new key and agree to the distribution terms. Otherwise such flights may appear in your results with an ident of "BLKFA" and its other fields will be blank/zero.
  • (2012-04) Enhanced FlightInfoEx to allow a faFlightID to be requested.
  • (2012-04) Changed AirportInfo to now return timezones conforming to the official IANA zoneinfo database.
  • (2012-04) Changed FlightInfo and FlightInfoEx to now return results sorted by filed_departuretime instead of file_time.
  • (2012-04) Changed RoutesBetweenAirportsEx to now allow maxDepartureAge and maxFileAge to be specified as blank to search the maximum routes available.
  • (2012-09) Added AirlineFlightSchedules again
  • (2013-03) FlightInfo and FlightInfoEx can now return results for tail/registration numbers for flights operating under a different callsign. FlightInfoEx also now supports "ident@departureTime" syntax, avoiding the need to call GetFlightID first
  • (2013-12) Added ident_or_reg operator to SearchBirdseyeInFlight
  • (2018-03) Removed AirlineInsight


Don't have an account? Register now (free) for customized features, flight alerts, and more!
Did you know that FlightAware flight tracking is supported by advertising?
You can help us keep FlightAware free by allowing ads from FlightAware.com. We work hard to keep our advertising relevant and unobtrusive to create a great experience. It's quick and easy to whitelist ads on FlightAware or please consider our premium accounts.