Cities GEO data and codes API

NOTE: This is the endpoint to fetch cities GEO data. Full list of endpoints available here: https://airhex.com/api/

Don't have an API key for cities GEO data API but want a try?

Get Started

Endpoint description
This endpoint retrieves specific city details or dumps the entire cities database with output in JSON, XML or CSV file

HTTP Request
GET https://content.airhex.com/api/v3.7.3/cities

Request Example
https://content.airhex.com/api/v3.7.3/cities?apikey=WcPi7fGFMTihmwdNxkn4XYwZtdhKuykg&code=NYC

*Note: At least one of these parameters is required: code/country_code/name/dump

Request Parameters

Parameter Required Value Type Default Description
apikey Required Any String none API key received from us. Contact us if you don't have one yet.
code Required* (at least one parameter with asterisk required) AAA-ZZZ String none 3 char code for a specific city (matched with IATA city code)
country_code Required* (at least one parameter with asterisk required) AA-ZZ String none 2 char country code (ISO 3166-1 Alpha-2)
name Required* (at least one parameter with asterisk required) Any String none Name of a specific city or multiple cities. Search will be performed for cities contains name provided with this parameter.
dump Required* (at least one parameter with asterisk required) 0 or 1 Integer 0 Set as "1" to get all entries from the database. Other required parameters will be ignored
response_type Optional JSON or XML or CSV String JSON Types of responses: JSON, XML or CSV (CSV downloads as a file)

Response Fields

Field Example Description
code NYC 3 char city code (matched with IATA city code)
country_code US ISO 3166-1 Alpha-2, 2 char country code of a specific city
name New York City City name
state_short NY Short state abbreviation for US, CA, AU cities
state_full New York Full state name for US, CA, AU cities
latitude 40.7143528 Latitude of a city center location
longitude -74.0059731 Longitude of a city center location
city_photo new! https://content.airhex.com/content/city_photos/5333.jpg Licensed for commercial use photo of the city
timezone America/New_York Timezone of the city
gmt -4 City GMT time difference
population 8992908 City population
popularity 43581634 City popularity (the higher the rank, the more popular the destination is)


Response Example (JSON)
[
    {
        "code": "NYC",
        "country_code": "US",
        "name": "New York City",
        "state_short": "NY",
        "state_full": "New York",
        "latitude": "40.7143528",
        "longitude": "-74.0059731",
        "city_photo": "https:\/\/content.airhex.com\/content\/city_photos\/5333.jpg",
        "timezone": "America\/New_York",
        "gmt": "-4",
        "population": "8992908",
        "popularity": "43581634"
    }
]


Response Example (XML)
<?xml version="1.0" encoding="UTF-8"?>
<cities>
 <city>
  <code>NYC</code>
  <country_code>US</country_code>
  <name>New York City</name>
  <state_short>NY</state_short>
  <state_full>New York</state_full>
  <latitude>40.7143528</latitude>
  <longitude>-74.0059731</longitude>
  <city_photo>https://content.airhex.com/content/city_photos/5333.jpg</city_photo>
  <timezone>America/New_York</timezone>
  <gmt>-4</gmt>
  <population>8992908</population>
  <popularity>43581634</popularity>
 </city>
</cities>


Want to fetch full cities data without watermarks?

Get a license