Airports

Airport lookup and sun/night-time calculations. The search and view endpoints are publicly accessible (no authentication required).


Search Airports

GET /airports/search.json?q={query}

Search airports by ICAO code, name, or city. First attempts an ICAO prefix match; if no results, falls back to name/city prefix match. Returns up to 10 results.

Query Parameters

Parameter
Type
Description

q

string

Search query (ICAO code, airport name, or city name)

Response

{
  "airports": [
    {
      "Airport": {
        "id": "LEBL",
        "name": "Barcelona El Prat",
        "lat": "41.2971",
        "lon": "2.0785"
      },
      "Country": { "id": "ES", "name": "Spain" },
      "Timezone": { "id": "1", "name": "Europe/Madrid" }
    }
  ]
}

View Airport

GET /airports/view/{airport}.json

GET /airports/view/{airport}/{date}.json

Retrieve full airport details including country and timezone. Optionally pass a date (Unix timestamp or date string) to get sunrise/sunset data for that day.

Path Parameters

Parameter
Type
Description

airport

string

ICAO airport code

date

string | number

Optional. Date for sun data (Unix timestamp or date string). Defaults to now.

Response


Calculate Night Time

GET /airports/night_time/{departure}/{arrival}/{dTime}/{aTime}.json

Calculate the night flying time for a given flight leg based on official sunrise/sunset at departure and arrival airports.

Times can be Unix timestamps or date-time strings. The calculation accounts for all scenarios: day flights, night flights, flights crossing sunrise/sunset, and multi-day flights.

Path Parameters

Parameter
Type
Description

departure

string

ICAO code of departure airport

arrival

string

ICAO code of arrival airport

dTime

string | number

Departure time (Unix timestamp or date string)

aTime

string | number

Arrival time (Unix timestamp or date string)

Response

seconds is the total night flying time in seconds. Returns 0 if the entire flight is in daylight.

Last updated