GET /city/{name} · /{name}/nearby · ?lat=&lon=

City API

Pass a name, a search, or coordinates. Get the city, then what is around it.

You have a city name. The largest match wins a tie.

Try it

name

City name

type

What the place is in its own country's words (city, town, commune, ward)

capital_of

country when it is a national capital, state when it is a state or region capital, null otherwise

district

District code the city sits in (US FIPS, FR INSEE, GB GSS)

country

ISO2 country code

elevation

Elevation in meters at the city center

area

Total area in km² (land + water, or the official total)

id

Stable city id (city_...). Fetch again at /city/id/{id}

nearby

Cities inside the radius, nearest first, each with distance and distance_mi

distance

Kilometers from query point (coords and nearby)

distance_mi

Miles from query point (coords and nearby)

1

Pass a name

The largest match wins a tie. Native name when it differs.

2

Search, pin, or nearby

q for typeahead. lat/lon for the nearest place. /nearby for the towns around it.

3

Official sources

27 countries. Not a worldwide filler dump.

27 countries.

Official sources. Every plan.

Find a city by exact name, typeahead search (?q=), coordinates, or the towns around it. Name lookups pin one city (the largest, if there is a tie). /city/{name}/nearby lists the places around an anchor. Coordinate lookups return the nearest place plus distance in miles and kilometers.

Type, capital, district, elevation, and land area ride every record. name is the English catalog name. local_name carries the native form when it differs. Tokyo's local_name reads 東京. Twenty-seven countries, each from its official national gazetteer.

Need the state or postal record itself? Use /state/{code} or /postal/{code}.

RESPONSE

$ curl "https://api.parseapi.com/city/charlotte" \
  -H "X-API-Key: YOUR_API_KEY"

// 200 · ~37ms US · ~113ms worldwide
{
  "name": "Charlotte",
  "local_name": null,
  "type": "city",
  "capital_of": null,
  "state": "NC",
  "state_name": "North Carolina",
  "district": "37119",
  "district_name": "Mecklenburg",
  "country": "US",
  "country_name": "United States",
  "latitude": 35.209045,
  "longitude": -80.83099,
  "elevation": 209,
  "elevation_ft": 686,
  "population": 943476,
  "area": 813.48,
  "land_area": 808.33,
  "water_area": 5.15,
  "timezone": "America/New_York",
  "id": "city_mb8mbqrkz8zb"
}

Response fields

name
City name
local_name
Local-language name (null when same as name)
type
What the place is in its own country's words (city, town, commune, ward)
capital_of
country when it is a national capital, state when it is a state or region capital, null otherwise
state
State or province code
state_name
State or province name
district
District code the city sits in (US FIPS, FR INSEE, GB GSS)
district_name
District name
country
ISO2 country code
country_name
Country name
latitude
Latitude
longitude
Longitude
elevation
Elevation in meters at the city center
elevation_ft
Elevation in feet
population
Population
area
Total area in km² (land + water, or the official total)
land_area
Land area in km² (null when the source publishes total only)
water_area
Water area in km² (null when the source publishes total only)
timezone
Timezone identifier
distance
Kilometers from query point (coords and nearby)
distance_mi
Miles from query point (coords and nearby)
id
Stable city id (city_...). Fetch again at /city/id/{id}

QUESTIONS

When do I use which?
A name pins one city. /nearby lists the towns around it. lat and lon finds the nearest, plus distance.
What comes back?
Name, type, capital, district, local_name when it differs, state, country, elevation, land area, population, timezone, and a stable id.
What is the id?
A pin for that city. Fetch it again at /city/id/{id}. The name path stays the usual way in.
What is local_name?
The native form when it differs from name. Tokyo is Tokyo. local_name reads 東京.
How do I find nearby cities?
GET /city/{name}/nearby. Default radius 40 km. Distance comes back in miles and kilometers on every row.
How do I find the nearest?
Pass lat and lon. Distance comes back in miles and kilometers.
Which countries?
Twenty-seven, each from its official national gazetteer. Listed below.

SPEED

How long a lookup takes.

US

37ms

EU

91ms

APAC

144ms

LatAm

18ms

ME

121ms

See live status →

Coverage

Twenty-seven countries, each from its official national gazetteer.

  • United States
  • Puerto Rico
  • Canada
  • Mexico
  • Brazil
  • United Kingdom
  • Ireland
  • France
  • Spain
  • Portugal
  • Belgium
  • Netherlands
  • Germany
  • Austria
  • Switzerland
  • Liechtenstein
  • Italy
  • Denmark
  • Sweden
  • Norway
  • Finland
  • Poland
  • Czechia
  • Japan
  • Taiwan
  • Australia
  • New Zealand

Miles and kilometers between two cities with the city distance tool.