The /cities endpoint is sorted by population by default, so "the biggest cities" is just a matter of how many you ask for — globally, or scoped to one country.
The most populous cities, worldwide
curl "https://countries.dev/cities?limit=5"[
{ "name": "Shanghai", "countryCode": "CN", "population": 24874500, "timezone": "Asia/Shanghai" },
{ "name": "Beijing", "countryCode": "CN", "population": 18960744, "timezone": "Asia/Shanghai" },
{ "name": "Shenzhen", "countryCode": "CN", "population": 17494398, "timezone": "Asia/Shanghai" },
{ "name": "Guangzhou", "countryCode": "CN", "population": 16096724, "timezone": "Asia/Shanghai" },
{ "name": "Kinshasa", "countryCode": "CD", "population": 16000000, "timezone": "Africa/Kinshasa" }
]Each city carries its latitude, longitude and IANA timezone, so the same call feeds a map marker or a "local time" label without a second request.
Biggest cities in one country
Add country (an ISO alpha-2 code) to scope the ranking:
curl "https://countries.dev/cities?country=JP&limit=5"[
{ "name": "Tokyo", "countryCode": "JP", "population": 8336599 },
{ "name": "Yokohama", "countryCode": "JP", "population": 3574443 },
{ "name": "Osaka", "countryCode": "JP", "population": 2592413 }
]Search within the results
q does an accent- and punctuation-insensitive match, still ordered by population — so a partial name resolves to the biggest match first:
curl "https://countries.dev/cities?q=san&country=US&limit=3"To go the other way — from coordinates to the nearest city — use reverse geocoding. And once you have a city's latitude/longitude, you can measure the distance between two of them.
Written by
Dov Azencot
At
Thu Jun 25 2026