Airports API

The Airports API provides vital information on nearly 30,000 airports worldwide including major international airports and small regional airports.

/v1/airports GET

https://api.api-ninjas.com/v1/airports

Returns a list of up to 30 airport results. Use the offset parameter to access more results if available.


Parameters

At least one of the following parameters (other than offset) must be set:

  • icao  optional

    International Civil Aviation Organization (ICAO) 4-character airport code.

  • iata  optional

    International Air Transport Association (IATA) 3-character airport code.

  • name  optional

    Airport name. This parameter supports partial matching (e.g. Heathrow will match London Heathrow Airport).

  • country  optional

    Airport country. Must be 2-character ISO-2 country code (e.g. GB).

  • region  optional

    Administrative region such as state or province within a country (e.g. California).

  • city  optional

    Airport city (e.g. London).

  • timezone  optional

    Airport timezone (e.g. Europe/London).

  • min_elevation  optional

    Minimum airport elevation in feet.

  • max_elevation  optional

    Maximum airport elevation in feet.

  • offset  optional

    Number of results to offset for pagination.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Sample Request Live Demo!

name
https://api.api-ninjas.com/v1/airports?name=London Heathrow

Sample Response

JSON
1 2 3 4 5 6 7 8 9 10 11 12 13 14 [ { "icao": "EGLL", "iata": "LHR", "name": "London Heathrow Airport", "city": "London", "region": "England", "country": "GB", "elevation_ft": "83", "latitude": "51.4706001282", "longitude": "-0.4619410038", "timezone": "Europe/London" } ]

Code Examples

1 2 3 4 5 6 7 8 import requests name = 'London Heathrow' api_url = 'https://api.api-ninjas.com/v1/airports?name={}'.format(name) response = requests.get(api_url, headers={'X-Api-Key': 'YOUR_API_KEY'}) if response.status_code == requests.codes.ok: print(response.text) else: print("Error:", response.status_code, response.text)

If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.