Airports
Airport lookup and sun/night-time calculations. The search and view endpoints are publicly accessible (no authentication required).
Search Airports
Section titled ā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
Section titled āQuery Parametersā| Parameter | Type | Description |
|---|---|---|
| q | string | Search query (ICAO code, airport name, or city name) |
Response
Section titled ā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
Section titled ā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
Section titled ā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
Section titled āResponseā{ "airport": { "Airport": { "id": "LEBL", "name": "Barcelona El Prat", "lat": "41.2971", "lon": "2.0785", "city": "Barcelona", "elevation": "12", "SunInfo": { "sunrise": 1736490000, "sunset": 1736530000, "civil_twilight_begin": 1736488200, "civil_twilight_end": 1736531800 } }, "Country": { "id": "ES", "name": "Spain" }, "Timezone": { "id": "1", "name": "Europe/Madrid" } }}Calculate Night Time
Section titled ā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
Section titled ā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
Section titled āResponseā{ "data": { "seconds": 3600, "departure": { "sunrise": 1736490000, "sunset": 1736530000, "civil_twilight_begin": 1736488200, "civil_twilight_end": 1736531800 }, "arrival": { "sunrise": 1736490600, "sunset": 1736530600, "civil_twilight_begin": 1736488800, "civil_twilight_end": 1736532200 } }}
secondsis the total night flying time in seconds. Returns0if the entire flight is in daylight.