City API

The City API provides useful statistics about tens of thousands of cities around the world.

/v1/city GET

Get city data from either a name or population range. Returns a list of cities that satisfies the parameters.


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

  • name  optional

    Name of city.

  • country  optional

    Country filter. Must be an ISO-3166 alpha-2 country code (e.g. US).

  • min_population  optional

    Minimum city population.

  • max_population  optional

    Maximum city population.

  • min_lat  optional

    Minimum latitude coordinate.

  • max_lat  optional

    Maximum latitude coordinate.

  • min_lon  optional

    Minimum longitude coordinate.

  • max_lon  optional

    Maximum longitude coordinate.

  • limit  optional

    How many results to return. Must be between 1 and 30. Default is 1. To get more than 30 results, use the offset parameter.

  • offset  premium  optional

    Number of results to offset for pagination.


  • X-Api-Key  required

    API Key associated with your account.

Sample Request Live Demo!

name Francisco

Sample Response

1 2 3 4 5 6 7 8 9 10 [ { "name": "San Francisco", "latitude": 37.7562, "longitude": -122.443, "country": "US", "population": 3592294, "is_capital": false } ]

Code Examples

1 2 3 4 5 6 7 8 9 import requests name = 'San Francisco' api_url = '{}'.format(name) response = requests.get(api_url, headers={'X-Api-Key': 'YOUR_API_KEY'}) if response.status_code == 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.