Blog / API guides

FlightAware API: Flight Tracking Data as JSON

To get FlightAware flight tracking data as JSON, call one of three Perceptlayer endpoints: GET /v1/flightaware/airport for an airport's arrivals or departures board (1 credit), GET /v1/flightaware/flight for one flight on one date with gate, runway and delay times (2–10 credits), and GET /v1/flightaware/flight-history for a flight number's recent and upcoming legs (1 credit). The recorded lookup of LH400 on 2026-11-16 returned status.state: "landed", a 23-minute departure delay and an arrival 14 minutes early. This guide shows the requests, parameters, real responses, a Python delay logger and the cost.

What does the FlightAware API on Perceptlayer cover?

The FlightAware API on Perceptlayer has three GET endpoints that return JSON: an airport board, a single flight lookup and a flight-number history. The airport and history endpoints cost 1 credit per successful call. The flight endpoint is ranged at 2–10 credits, because the cost depends on the call; the X-Credits-Used header on each response tells you what that call cost.

Method Path Returns Credits Required Optional
GET /v1/flightaware/airport Airport board 1 code mode
GET /v1/flightaware/flight One flight 2–10 ident, date fetch_by, origin, destination, time, track
GET /v1/flightaware/flight-history Flight history 1 ident fetch_by

The data is collected from publicly available sources and returned as found at the time of the call. These endpoints aren't FlightAware's own developer API, and this guide makes no claims about that API, its plans or its terms; if you're weighing the two, compare them yourself and read FlightAware's terms. The FlightAware API page has all three endpoints and a playground to run them with your key.

How do you send a request?

Send a GET request to https://api.perceptlayer.com with the endpoint path, its parameters in the query string and your key in the X-API-Key header. This is the request behind the recorded airport board in this guide:

curl "https://api.perceptlayer.com/v1/flightaware/airport?code=EDDF&mode=arrivals" \
  -H "X-API-Key: $API_KEY"

Keys start with sk_live_. Where you can't set a header, pass the key in the api_key query parameter; the authentication docs cover both. Every successful response carries X-Credits-Used and X-Credits-Remaining, and the recorded airport response also reports credits_charged: 1 in meta.

Which parameters do the endpoints take?

The three endpoints take eight distinct parameters between them. The table lists each with what the API documents: type, whether it's required and any allowed values. Nothing else about them is documented, including formats for date and time, so run your values in the playground before you build a job on them.

Endpoint Parameter Type Required Documented values
airport code string yes None documented
airport mode string no arrivals, departures, enroute, scheduled
flight ident string yes None documented
flight date string yes None documented
flight fetch_by string no flight, reg
flight origin string no None documented
flight destination string no None documented
flight time string no None documented
flight track boolean no None documented
flight-history ident string yes None documented
flight-history fetch_by string no flight, reg

The recordings give some working values. The airport call used the ICAO code EDDF. The flight call used ident=LH400 and date=2026-11-16, and the response explains its own date: date_basis reads "UTC date of the scheduled departure". That call didn't send fetch_by, and the response reports fetch_by: "flight".

What does an airport board return?

An airport board returns the airport, the mode, a count and a rows array with one entry per flight. Each row has the flight ident, the airline name, the aircraft type, origin and destination codes, the scheduled departure in UTC and local departure and arrival times with their time zone. This is the recorded Frankfurt arrivals board, trimmed to one row:

{
  "success": true,
  "data": {
    "code": "EDDF",
    "icao": "EDDF",
    "mode": "arrivals",
    "board": "current",
    "airport": {
      "icao": "EDDF",
      "name": "Frankfurt/Main Airport"
    },
    "count": 20,
    "rows": [
      {
        "ident": "THY6405",
        "airline": {
          "name": "Turkish Airlines"
        },
        "aircraft": {
          "type": "A330",
          "name": "Airbus A330 (twin-jet)"
        },
        "origin": {
          "icao": "LTFM",
          "iata": "IST",
          "name": "Istanbul"
        },
        …
        "scheduled_departure": "2026-11-18T01:30:00Z",
        "departure": {
          "local_time": "04:39",
          "zone": "+03",
          "estimated": false
        },
        "arrival": {
          "local_time": "05:26",
          "zone": "CET",
          "estimated": false
        }
      },
      …
    ]
  },
  "meta": {
    "endpoint_family": "airport_board",
    …
    "credits_charged": 1,
    …
  }
}

Two details matter if you store these rows. scheduled_departure is a full UTC timestamp, but departure.local_time and arrival.local_time are clock times with a zone label and no date, so keep the call time next to them. And the estimated flag tells you whether a local time is an estimate; in the recording, both rows report false.

What does a single flight lookup return?

A flight lookup returns one leg with its status, airline, aircraft, both airports with terminal and gate, four sets of scheduled, estimated and actual times, the delay in minutes, distances and the filed flight plan. It's the endpoint to use when you need what happened to a specific flight. This is the recorded LH400 response for 2026-11-16, trimmed:

{
  "success": true,
  "data": {
    "query": "LH400",
    "fetch_by": "flight",
    "ident": "DLH400",
    "date": "2026-11-16",
    "date_basis": "UTC date of the scheduled departure",
    "found_by": "list",
    "lookups": 2,
    …
    "leg": {
      "ident": "DLH400",
      "iata_ident": "LH400",
      "status": {
        "state": "landed",
        "text": "Landed",
        "live": false,
        "cancelled": false,
        "diverted": false,
        "raw": "arrived"
      },
      "aircraft": {
        "type": "A359",
        "type_name": "Airbus A350-900 (twin-jet)",
        …
      },
      "origin": {
        "icao": "EDDF",
        "iata": "FRA",
        …
        "timezone": "Europe/Berlin",
        "terminal": "1",
        "gate": "Z50",
        …
      },
      …
      "times": {
        "gate_departure": {
          "scheduled": "2026-11-16T10:00:00Z",
          "estimated": "2026-11-16T10:10:00Z",
          "actual": "2026-11-16T10:23:00Z"
        },
        …
        "gate_arrival": {
          "scheduled": "2026-11-16T18:35:00Z",
          "estimated": "2026-11-16T18:25:31Z",
          "actual": "2026-11-16T18:21:00Z"
        }
      },
      "delay": {
        "departure_minutes": 23,
        "arrival_minutes": -14
      },
      "distance_nm": {
        "direct": 3346,
        "planned": 3411,
        "flown": 3435
      },
      …
      "track_points": 735
    }
  },
  …
}
Field What a job does with it
leg.status.state, cancelled, diverted Outcome of the flight; state was landed in the recording
leg.times.*.scheduled, estimated, actual Gate and runway times in UTC
leg.delay.departure_minutes, arrival_minutes Delay in minutes; negative means early (-14 in the recording)
leg.origin.gate, terminal, timezone Where the flight left from and how to convert times
leg.distance_nm Direct, planned and flown distance in nautical miles

The request sent LH400 and the response resolved it to ident: "DLH400" with iata_ident: "LH400", so store both. The call didn't send track, yet the response reports track_points: 735; what setting track adds isn't documented, so test it in the playground and watch X-Credits-Used before you turn it on in a job.

What does flight history add?

Flight history lists the legs flown or scheduled under one flight number over a window of days, at 1 credit per call. The recorded LH400 call returned window_days: 14 and count: 16, and each leg has a status, aircraft model, both airports with UTC offsets and a scheduled departure. The first two legs in the recording are both scheduled departures from FRA to JFK:

{
  "success": true,
  "data": {
    "query": "LH400",
    "fetch_by": "flight",
    "ident": "DLH400",
    "window_days": 14,
    "count": 16,
    "flights": [
      {
        "flight_number": "LH400",
        "status": {
          "live": false,
          "text": "Scheduled",
          "state": "scheduled",
          "type": "departure"
        },
        "aircraft": {
          "model_code": "A359"
        },
        …
        "times": {
          "scheduled_departure": "2026-11-19T10:10:00Z"
        },
        …
      },
      …
    ]
  },
  …
}

Both the history and the flight call took LH400 and report ident: "DLH400", so the identifiers match. In the recording, history legs carry only times.scheduled_departure, while the flight endpoint returns the full set of gate and runway times. A history call is the cheap way to see which dates a flight number runs; a flight call is how you get what happened on one of them.

How do you log flight delays with Python?

A delay logger calls the flight endpoint once per flight number and date, then appends one row with the status, both delays, the airports and the actual gate times. Run it daily for yesterday's flights and you build a delay history per route. The script below uses requests and csv and reads only fields in the recorded flight response, treating each as optional.

import csv
import datetime
import os
import time

import requests

API_KEY = os.environ["API_KEY"]
URL = "https://api.perceptlayer.com/v1/flightaware/flight"
FLIGHTS = ["LH400"]  # add your flight numbers
DATE = (datetime.date.today() - datetime.timedelta(days=1)).isoformat()


def lookup(ident, date, attempts=3):
    for _ in range(attempts):
        r = requests.get(URL, params={"ident": ident, "date": date},
                         headers={"X-API-Key": API_KEY}, timeout=90)
        if r.status_code in (429, 503):
            time.sleep(int(r.headers.get("Retry-After", "5")))
            continue
        r.raise_for_status()
        return r.json()["data"], r.headers.get("X-Credits-Used")
    raise RuntimeError(f"gave up on {ident} {date}")


with open("flight-delays.csv", "a", newline="") as f:
    out = csv.writer(f)
    for ident in FLIGHTS:
        data, used = lookup(ident, DATE)
        leg = data.get("leg", {})
        status = leg.get("status", {})
        delay = leg.get("delay", {})
        times = leg.get("times", {})
        out.writerow([
            DATE, ident, leg.get("ident"), status.get("state"),
            status.get("cancelled"), status.get("diverted"),
            leg.get("origin", {}).get("iata"), leg.get("destination", {}).get("iata"),
            delay.get("departure_minutes"), delay.get("arrival_minutes"),
            times.get("gate_departure", {}).get("actual"),
            times.get("gate_arrival", {}).get("actual"), used,
        ])
        time.sleep(1)

The last column logs X-Credits-Used, so you can see where in the 2–10 range your calls land. The one-second pause keeps a free account within its 1 request a second.

What should the job do with errors?

Every error returns an HTTP status and a JSON body with code, message and request_id, and costs nothing. Retry rate_limited (429) and temporarily_unavailable (503) after the Retry-After seconds. Treat invalid_parameters (422) as a bug in your inputs and not_found (404) as a flight or date to skip. Requests have no idempotency key, so a client timeout can hide a call that succeeded and was billed; keep the timeout generous. The errors docs list every code.

What does FlightAware data cost?

The airport board and flight history cost 1 credit per successful call. The flight lookup costs 2–10 credits, so budget at 10 credits per lookup and treat anything lower as savings. An airport board spreads its credit across every row it returns: the recorded Frankfurt board returned 20 flights for 1 credit.

Plan Arithmetic Credits a month
1 airport, arrivals and departures, hourly 2 × 24 × 30 days × 1 credit 1,440
50 flight numbers, history daily 50 × 30 days × 1 credit 1,500
20 flight lookups daily 20 × 30 days × 10 credits (top of range) 6,000
150 flight lookups daily 150 × 30 days × 10 credits (top of range) 45,000

The first three fit the Starter pack's 10,000 credits, and the last fits the Build pack's 50,000. The 100 free credits on signup cover 100 airport boards, or at least 10 flight lookups at the top of the range. Failed calls cost nothing and return X-Credits-Used: 0. See pricing for what credits cost and the credits docs for how calls are debited.

To start, run code=EDDF with mode=arrivals in the playground on the airport endpoint page, then try LH400 on the flight endpoint page. Other travel sources are on the travel APIs page, and more guides like this are in API guides.

APIs in this post

Frequently asked questions

Is this FlightAware's official API?

No. These are Perceptlayer endpoints that return FlightAware flight data collected from publicly available sources, as found at the time of the call. This guide makes no claims about FlightAware's own API, its plans or its terms. If you're choosing between the two, compare them yourself, and read FlightAware's terms before you use the data commercially.

Why does the flight endpoint cost 2–10 credits?

The flight endpoint shows a range because its cost depends on the call. Every successful response carries X-Credits-Used with what that call cost, so log it and you'll see where your lookups land. For budgets, assume 10 credits per lookup. The airport board and flight history are fixed at 1 credit per successful call, and failed calls cost nothing.

What date format does the flight endpoint expect?

The API documents date only as a required string. The recorded call used date=2026-11-16, and the response's date_basis field says the date is the UTC date of the scheduled departure. Use that format, and for flights that depart late in the evening local time, check the UTC date before you send the request.

Can I get departures instead of arrivals?

Yes. The airport endpoint's mode parameter takes arrivals, departures, enroute or scheduled. The recorded response is the arrivals board for EDDF, with count: 20 and board: "current". Each mode is a separate call at 1 credit, so a job that keeps both arrivals and departures for one airport makes two calls per run.

How fast can I poll these endpoints?

Limits are per account, shared by all its keys, and counted per minute. A free account gets 1 request a second, 60 a minute. Paying accounts run at least 5 requests a second, 300 a minute, depending on the pack. Rate-limited calls return 429 with a Retry-After header and cost nothing. The rate limits docs list each pack's rate.

  1. Depop API: Resale Listings as JSON

    Search Depop listings as JSON with brand, condition, sizes and price.amount per item; the recorded jacket search had a total_count of 6,815,522. 1 credit.

  2. Similarweb API: Website Traffic Data as JSON

    Get Similarweb traffic estimates as JSON: visits, bounce_rate, traffic_sources, top_countries and top_keywords for a domain, at 1 credit a call.

  3. StockTwits API: Symbol Streams as JSON

    Three StockTwits endpoints as JSON: a symbol's message stream with sentiment and cursor, symbol search and trending symbols, each 1 credit a call.

Start with 100 free credits

No password to set. We email you a sign-in link, and your key works on every API.

No credit card. 100 free credits on signup.