Is there any API that lists states and cities?


I've been looking for some json API that lists the states of a certain country, or cities of a certain state, I've looked for this functionality through various Google Maps APIs but I did not find anything that was exactly for that.

I do not want to use a DB with a list of states and cities because I believe it lacks flexibility and is quite heavy.

Note: I need to create a combobox of countries, states and cities, but I can use a list of countries directly from the database without any problem, but if there is an API that makes this list available, p>

Is there a good option?

asked by anonymous 25.07.2015 / 17:18

1 answer


You can use the service.

This example page shows the calls to the service:


The specific function you want to use is Children , which returns collections of child entities of a given GeoNameID - countries of a continent, states of a country, cities of a state and so on.

The above example makes the following calls:

  • Gets a list of continents


  • After selecting South America ( GeoNameID 6255150), you get the list of countries


  • After selecting Brazil (GeoNameID 3469034), you get the list of states


  • The end result is a list similar to the example below:

    25.07.2015 / 18:37