If you want to build booking platforms or just create the next popular flight tracking application, try aviationstack. This data API is used by thousands every day. The great thing is, this service is free to use!

aviation stack

What is aviationstack?

aviationstack is a good service that offers extensive set of aviation data, including real-time flight status, historical flights, schedules, airline routes, airports, aircrafts, and more.

laravel aviationstack

Features

Extensive Flight Data

Tap into an extensive set of aviation data, including real-time flight status, historical flights, schedules, airline routes, airports, aircrafts, and more.

Worldwide Coverage

Powered by a strong backbone of aviation data sources, the API delivers accurate details about any global flight at any stage, even down to the minute.

Powerful Infrastructure

The API is built on top of scalable cloud infrastructure, capable of handling any volume — from thousands of requests per month to millions per minute.

Easy on Your Budget

Sign up for the Free Plan to get 500 free API requests per month.

Documentation

You can read the official documentation on the aviationstack website.

How to use

Register to get a free API key

You need to go to aviationstack and register to get a free API key.

Using Raw PHP

You can use raw PHP to grab the flight data. Here is the sample code (which can be found at aviationstack documentation):

$queryString = http_build_query([
  'access_key' => 'YOUR_ACCESS_KEY'
]);

$ch = curl_init(sprintf('%s?%s', 'https://api.aviationstack.com/v1/flights', $queryString));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$json = curl_exec($ch);
curl_close($ch);

$api_result = json_decode($json, true);

foreach ($api_result['results'] as $flight) {
    if (!$flight['live']['is_ground']) {
        echo sprintf("%s flight %s from %s (%s) to %s (%s) is in the air.",
            $flight['airline']['name'],
            $flight['flight']['iata'],
            $flight['departure']['airport'],
            $flight['departure']['iata'],
            $flight['arrival']['airport'],
            $flight['arrival']['iata']
            ), PHP_EOL;
    }
}

Using Node.js

const axios = require('axios');
const params = {
  access_key: 'YOUR_ACCESS_KEY'
}

axios.get('https://api.aviationstack.com/v1/flights', {params})
  .then(response => {
    const apiResponse = response.data;
    if (Array.isArray(apiResponse['results'])) {
        apiResponse['results'].forEach(flight => {
            if (!flight['live']['is_ground']) {
                console.log(`${flight['airline']['name']} flight ${flight['flight']['iata']}`,
                    `from ${flight['departure']['airport']} (${flight['departure']['iata']})`,
                    `to ${flight['arrival']['airport']} (${flight['arrival']['iata']}) is in the air.`);
            }
        });
    }
  }).catch(error => {
    console.log(error);
  });