IATA City Codes API

Turn city codes into destinations travelers recognize. Match three-letter IATA city codes to city names, countries and available state details, or download the directory to power destination search in your travel product.

  • Lookup by city code or name
  • Country-based destination lists
  • JSON, XML and CSV

Look up a destination by IATA city code

Pass NYC in the code parameter of the Cities API to retrieve New York City. Replace YOUR_API_KEY with your assigned key.

Request · cURL

curl --get 'https://content.airhex.com/api/v3.7.10/cities/' \
  --data-urlencode 'apikey=YOUR_API_KEY' \
  --data-urlencode 'code=NYC'

Response · JSON excerpt

[
  {
    "airhex_id": "5333",
    "code": "NYC",
    "country_code": "US",
    "name": "New York City",
    "state_short": "NY",
    "state_full": "New York",
    ...
  }
]

Abbreviated response. The ellipsis (…) represents additional city fields omitted here and is not part of the actual JSON response.

View the full Cities API reference →

Request parameters

Look up a city code, find destinations by name or country, or export the city directory.

ParameterRequiredDefaultDescription
apikey YesNoneYour assigned API key. Get a free test API key.
code ConditionalNoneThree-letter IATA city code, such as NYC.
country_code ConditionalNoneTwo-letter ISO country code, such as US, to retrieve cities in a country.
name ConditionalNoneCity name or partial name for search matching.
dump Conditional0Set to 1 to export the complete database. Overrides the other lookup parameters.
response_type NoJSONResponse format: JSON, XML or CSV. CSV triggers a file download.

Provide at least one of code, country_code, name, or dump=1. The Cities API uses code, not iata, for a city-code lookup.

View all request parameters →

Available data

Use the city code to resolve a destination and the accompanying name and location fields to display it clearly. Retain airhex_id when maintaining your local records.

FieldTypeExampleDescription
airhex_id Identifier5333Permanent Airhex record identifier for maintaining your local destination directory.
code StringNYCThree-letter IATA city code for matching destination records.
country_code StringUSTwo-letter ISO country code for country labels and destination grouping.
name StringNew York CityCity name for destination search, booking screens and itineraries.
state_short StringNYState or province abbreviation, available for US, Canadian and Australian cities.
state_full StringNew YorkFull state or province name, available for US, Canadian and Australian cities.

View all available data →

Common implementation tasks

Download city codes for your destination selector

Export the city directory as CSV and build a local search index from codes, names, countries and available state details. Display enough location context to help travelers distinguish cities with similar names.

curl --get 'https://content.airhex.com/api/v3.7.10/cities/' \
  --data-urlencode 'apikey=YOUR_API_KEY' \
  --data-urlencode 'dump=1' \
  --data-urlencode 'response_type=CSV' \
  --output city-codes.csv

Find a city code from a destination name

Search with name and read code from the returned records. Partial matching can produce several results, so compare country and state details before choosing a destination.

curl --get 'https://content.airhex.com/api/v3.7.10/cities/' \
  --data-urlencode 'apikey=YOUR_API_KEY' \
  --data-urlencode 'name=New York'

Build a destination list for a country

Pass country_code=US to retrieve city records for the United States. Use their codes and names for a country-specific destination list; flight availability must come from your booking supplier.

curl --get 'https://content.airhex.com/api/v3.7.10/cities/' \
  --data-urlencode 'apikey=YOUR_API_KEY' \
  --data-urlencode 'country_code=US'

Find airports associated with a city

After resolving a city, pass its code as city_code to the Airports API. This example requests airports with commercial flights associated with NYC. Keep each airport’s own code and name when displaying airport choices; the Cities API response does not contain an airport list.

curl --get 'https://content.airhex.com/api/v3.7.10/airports/' \
  --data-urlencode 'apikey=YOUR_API_KEY' \
  --data-urlencode 'city_code=NYC' \
  --data-urlencode 'major_only=1'

What you can build

Recognizable destination search

Show city names with country and state context instead of asking travelers to interpret destination codes.

City and airport choices

Support city-level destination choices alongside individual airports, using the Cities and Airports APIs to label each option clearly.

Consistent destination reporting

Match coded destinations to the same city records across booking tools, customer support and reports.

Frequently asked questions

How is an IATA city code different from an airport code?

A city code identifies a destination at city level, while an airport code identifies an individual airport. A city can be associated with multiple airports. Keep the supplier’s location type alongside its code so your application knows whether to look up a city or an airport.

Which parameter should I use to look up a city code?

Use code on the Cities API, such as code=NYC. The Airports API uses iata for an individual airport lookup and city_code to find airports associated with a city. These parameter names are specific to their endpoints.

Can I use this for an “all airports” destination option?

Use the city record to label the destination and the Airports API to retrieve associated airports. Confirm how your flight supplier accepts city-level searches and which airports it includes. City reference data alone does not define a supplier’s search coverage or guarantee a bookable route.

Can I find a city code by searching its name?

Yes. The name parameter supports partial matching. Compare the returned name, country_code and available state fields instead of automatically selecting the first result. Preserve the selected city code and identity once the user chooses a destination.

Does every city have an IATA code?

Do not treat this directory as a list of every municipality. Build your code lookup from the returned city records, and check that code is populated before creating a code-based mapping. Handle destinations that your application cannot resolve without guessing a code from their names.

Are state and province names available for every country?

The documented state_short and state_full fields apply to cities in the United States, Canada and Australia. Handle empty values for other destinations and use the city name and country code as the basic display context.

Can I download and store the city code directory?

Yes, with an appropriate GEO Essentials license. Use dump=1 and choose JSON, XML or CSV with response_type. Retain airhex_id as the permanent record identifier and updated from the full response, and refresh your local directory periodically.

Does this include flight routes, fares or availability?

No. The Cities API provides destination reference data. Use your flight supplier for route coverage, schedules, fares and availability; a city appearing in the directory does not establish that a particular journey is available to book.

Help travelers find the right destination

Build clearer city search and destination choices across your travel product, without maintaining your own IATA city code directory.

Cities API →

Explore the complete city dataset, including IATA city codes, names, countries, state details, coordinates, time zones and destination images. View all request parameters and response fields, with individual lookups, country-based searches and bulk exports in JSON, XML and CSV.