AirHex cities endpoint API v3.4 reference

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


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.4/cities

Request Example
https://content.airhex.com/api/v3.4/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
language Optional en, ru String en Response language. Currently supports English and Russian languages
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 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
timezone America/New_York Timezone of the city
gmt -5 City GMT time difference
population 8175133 City population


Response Example (JSON)
[
    {
        "code": "NYC",
        "country_code": "US",
        "name": "New York",
        "state_short": "NY",
        "state_full": "New York",
        "latitude": "40.7143528",
        "longitude": "-74.0059731",
        "timezone": "America\/New_York",
        "gmt": "-5",
        "population": "8175133"
    }
]


Response Example (XML)
<?xml version="1.0" encoding="UTF-8"?>
<cities>
 <city>
  <code>NYC</code>
  <country_code>US</country_code>
  <name>New York</name>
  <state_short>NY</state_short>
  <state_full>New York</state_full>
  <latitude>40.7143528</latitude>
  <longitude>-74.0059731</longitude>
  <timezone>America/New_York</timezone>
  <gmt>-5</gmt>
  <population>8175133</population>
 </city>
</cities>


Still have some questions?
Just write us and we would be happy to help you with our API.