Search by task, endpoint, field, or error.
City API
Exact name, typeahead, nearest, or nearby cities.
Look up a city by exact name. If several match, you get the largest by population. Optional ?country= and ?state= filters. Core includes type, district, coordinates and timezone where known, with a stable city ID. Paid ?deep=true adds capital status, elevation, population and area where available.
Coverage is curated per country from official national gazetteers: the US, Canada, Mexico, Brazil, Puerto Rico, the UK, Ireland, France, Spain, Belgium, the Netherlands, Germany, Austria, Switzerland, Liechtenstein, Italy, Portugal, Denmark, Sweden, Norway, Finland, Poland, Czechia, Japan, Taiwan, Australia, and New Zealand. A country outside the list returns an empty result.
By name
Parameters 5
- namestring · path · required
City name
- countrystring · query · optional
ISO country code to disambiguate
- statestring · query · optional
State code such as FL or US-FL. Get codes from /country/{country}/states. State names return 400. A country prefix must match the country filter.
Length: 1 to 6 characters
Pattern:
^(?:[A-Za-z]{2}-)?[A-Za-z0-9]{1,3}$- langstring · query · optional
Display language as one BCP 47 tag, such as fr or zh-Hant. Changes supported display labels only; IDs, codes, native names, facts, parsing and deep access stay unchanged. Omit for the original response. Unsupported regions use the supported language base; unsupported languages or scripts use English. Missing labels retain their source value. Accept-Language is not read automatically. Available on the current API contract; frozen 1.0.0 is unchanged.
Length: 2 to 64 characters
- deepboolean · query · optional
Population, area, elevation and capital status. Included on paid plans.
import { parseAPI } from '@parseapi/sdk';
const parse = parseAPI("YOUR_API_KEY");
const result = await parse.city("charlotte");
console.log(result);Run on your server with a secret key. Calling from a browser or app?
{
"name": "Charlotte",
"name_local": null,
"type": "city",
"state": "NC",
"state_name": "North Carolina",
"district": "37119",
"district_name": "Mecklenburg",
"country": "US",
"country_name": "United States",
"latitude": 35.209045,
"longitude": -80.83099,
"timezone": "America/New_York",
"id": "city_mb8mbqrkz8zb"
}Response fields
- namestring or null
- City name
- name_localstring or null
- Local-language name, null when absent or identical to name
- typestring or null
- What the place is in its own country's words (city, town, commune, ward)
- statestring or null
- State or province code
- state_namestring or null
- State or province name
- districtstring or null
- District code the city sits in (US FIPS, FR INSEE, GB GSS)
- district_namestring or null
- District name
- countrystring or null
- ISO2 country code
- country_namestring or null
- Country name
- latitudenumber or null
- Latitude
- longitudenumber or null
- Longitude
- timezonestring or null
- Timezone identifier
- distancenumber
- Kilometers from query point (coords and nearby)
- distance_minumber
- Miles from query point (coords and nearby)
- idstring or null
- Stable city id (city_...). Fetch again at /city/id/{id}
By stable ID
Parameters 3
- idstring · path · required
Stable city id from any city response
- langstring · query · optional
Display language as one BCP 47 tag, such as fr or zh-Hant. Changes supported display labels only; IDs, codes, native names, facts, parsing and deep access stay unchanged. Omit for the original response. Unsupported regions use the supported language base; unsupported languages or scripts use English. Missing labels retain their source value. Accept-Language is not read automatically. Available on the current API contract; frozen 1.0.0 is unchanged.
Length: 2 to 64 characters
- deepboolean · query · optional
Population, area, elevation and capital status. Included on paid plans.
Store the id returned by a lookup, search, nearest or nearby result. Use it here to retrieve that city without repeating a name search. The response uses the same city fields as By name above, including optional paid Deep.
Search
Prefix search for city pickers and typeahead. ?limit= caps results, default 10, max 50.
Parameters 8
- qstring · query · optional
City name prefix, at least two characters. Required for search; use lat and lon instead for the nearest city.
Length: 2 to no maximum characters
- latnumber · query · optional
Latitude. Pass with lon for the nearest city, or use q for name search.
Range: -90 to 90
- lonnumber · query · optional
Longitude. Required with lat; use q instead for name search.
Range: -180 to 180
- countrystring · query · optional
Two-letter country code to narrow name-search results.
Pattern:
^[a-zA-Z]{2}$- statestring · query · optional
State code such as FL or US-FL. Get codes from /country/{country}/states. State names return 400. A country prefix must match the country filter.
Length: 1 to 6 characters
Pattern:
^(?:[A-Za-z]{2}-)?[A-Za-z0-9]{1,3}$- limitinteger · query · optional
Maximum number of prefix-search results. Nearest-city lookup returns one city.
Default:
10Range: 1 to 50
- langstring · query · optional
Display language as one BCP 47 tag, such as fr or zh-Hant. Changes supported display labels only; IDs, codes, native names, facts, parsing and deep access stay unchanged. Omit for the original response. Unsupported regions use the supported language base; unsupported languages or scripts use English. Missing labels retain their source value. Accept-Language is not read automatically. Available on the current API contract; frozen 1.0.0 is unchanged.
Length: 2 to 64 characters
- deepboolean · query · optional
Population, area, elevation and capital status. Included on paid plans.
import { parseAPI } from '@parseapi/sdk';
const parse = parseAPI("YOUR_API_KEY");
const result = await parse.city.search("char", { country: "US", limit: 10 });
console.log(result);Run on your server with a secret key. Calling from a browser or app?
This example shows selected fields or shortened lists. Run the request for the full response.
{
"q": "char",
"country": "US",
"cities": [
{
"name": "Charlotte",
"name_local": null,
"type": "city",
"state": "NC",
"state_name": "North Carolina",
"district": "37119",
"district_name": "Mecklenburg",
"country": "US",
"country_name": "United States",
"latitude": 35.209045,
"longitude": -80.83099,
"timezone": "America/New_York",
"id": "city_mb8mbqrkz8zb"
},
{
"name": "Charleston",
"name_local": null,
"type": "city",
"state": "SC",
"state_name": "South Carolina",
"district": "45019",
"district_name": "Charleston",
"country": "US",
"country_name": "United States",
"latitude": 32.828017,
"longitude": -79.972896,
"timezone": "America/New_York",
"id": "city_ngm2jafnwk7y"
}
]
}Response fields
Nearest
Closest city to a lat/lon, with miles and km. Good for enriching a point with a place name.
Parameters 8
- qstring · query · optional
City name prefix, at least two characters. Required for search; use lat and lon instead for the nearest city.
Length: 2 to no maximum characters
- latnumber · query · optional
Latitude. Pass with lon for the nearest city, or use q for name search.
Range: -90 to 90
- lonnumber · query · optional
Longitude. Required with lat; use q instead for name search.
Range: -180 to 180
- countrystring · query · optional
Two-letter country code to narrow name-search results.
Pattern:
^[a-zA-Z]{2}$- statestring · query · optional
State code such as FL or US-FL. Get codes from /country/{country}/states. State names return 400. A country prefix must match the country filter.
Length: 1 to 6 characters
Pattern:
^(?:[A-Za-z]{2}-)?[A-Za-z0-9]{1,3}$- limitinteger · query · optional
Maximum number of prefix-search results. Nearest-city lookup returns one city.
Default:
10Range: 1 to 50
- langstring · query · optional
Display language as one BCP 47 tag, such as fr or zh-Hant. Changes supported display labels only; IDs, codes, native names, facts, parsing and deep access stay unchanged. Omit for the original response. Unsupported regions use the supported language base; unsupported languages or scripts use English. Missing labels retain their source value. Accept-Language is not read automatically. Available on the current API contract; frozen 1.0.0 is unchanged.
Length: 2 to 64 characters
- deepboolean · query · optional
Population, area, elevation and capital status. Included on paid plans.
import { parseAPI } from '@parseapi/sdk';
const parse = parseAPI("YOUR_API_KEY");
const result = await parse.city.nearest(35.2271, -80.8431);
console.log(result);Run on your server with a secret key. Calling from a browser or app?
{
"name": "Charlotte",
"name_local": null,
"type": "city",
"state": "NC",
"state_name": "North Carolina",
"district": "37119",
"district_name": "Mecklenburg",
"country": "US",
"country_name": "United States",
"latitude": 35.209045,
"longitude": -80.83099,
"timezone": "America/New_York",
"distance": 0.4,
"distance_mi": 0.25,
"id": "city_mb8mbqrkz8zb"
}Response fields
- namestring or null
- City name
- name_localstring or null
- Local-language name, null when absent or identical to name
- typestring or null
- What the place is in its own country's words (city, town, commune, ward)
- statestring or null
- State or province code
- state_namestring or null
- State or province name
- districtstring or null
- District code the city sits in (US FIPS, FR INSEE, GB GSS)
- district_namestring or null
- District name
- countrystring or null
- ISO2 country code
- country_namestring or null
- Country name
- latitudenumber or null
- Latitude
- longitudenumber or null
- Longitude
- timezonestring or null
- Timezone identifier
- distancenumber
- Kilometers from query point
- distance_minumber
- Miles from query point
- idstring or null
- Stable city id (city_...). Fetch again at /city/id/{id}
Nearby
Cities around a named place, nearest first, with miles and km. Default radius 40 km. ?unit=mi or legacy ?miles=. Radius is a query dial, never a path segment.
Parameters 8
- namestring · path · required
Anchor city name
- countrystring · query · optional
ISO country code to disambiguate the anchor
- statestring · query · optional
State code such as FL or US-FL. Get codes from /country/{country}/states. State names return 400. A country prefix must match the country filter.
Length: 1 to 6 characters
Pattern:
^(?:[A-Za-z]{2}-)?[A-Za-z0-9]{1,3}$- radiusnumber · query · optional
Search radius (default 40 km, max 800 km / 500 mi)
- unitstring · query · optional
Radius unit, km (default) or mi
Values:
km, mi- limitinteger · query · optional
Max results, default 10, max 50
- langstring · query · optional
Display language as one BCP 47 tag, such as fr or zh-Hant. Changes supported display labels only; IDs, codes, native names, facts, parsing and deep access stay unchanged. Omit for the original response. Unsupported regions use the supported language base; unsupported languages or scripts use English. Missing labels retain their source value. Accept-Language is not read automatically. Available on the current API contract; frozen 1.0.0 is unchanged.
Length: 2 to 64 characters
- deepboolean · query · optional
Population, area, elevation and capital status. Included on paid plans.
import { parseAPI } from '@parseapi/sdk';
const parse = parseAPI("YOUR_API_KEY");
const result = await parse.city.nearby("denver", { radius: 8, unit: "mi", limit: 3 });
console.log(result);Run on your server with a secret key. Calling from a browser or app?
This example shows selected fields or shortened lists. Run the request for the full response.
{
"city": "Denver",
"state": "CO",
"country": "US",
"radius": 8,
"unit": "mi",
"nearby": [
{
"name": "Glendale",
"name_local": null,
"type": "city",
"state": "CO",
"state_name": "Colorado",
"district": "08005",
"district_name": "Arapahoe",
"country": "US",
"country_name": "United States",
"latitude": 39.703052,
"longitude": -104.936157,
"timezone": "America/Denver",
"distance": 8.06,
"distance_mi": 5.01,
"id": "city_5bjs2r33bamc"
}
]
}Response fields
Deep
?deep=true Population, area, elevation and capital status. Included on paid plans.
Run this Deep example with a paid-plan key. Deep is included in the pooled request, with no separate lookup charge.
import { parseAPI } from '@parseapi/sdk';
const parse = parseAPI("YOUR_API_KEY");
const result = await parse.city("denver", { country: "US", deep: true });
console.log(result);Run on your server with a secret key. Calling from a browser or app?
{
"name": "Denver",
"name_local": null,
"type": "city",
"state": "CO",
"state_name": "Colorado",
"district": "08031",
"district_name": "Denver",
"country": "US",
"country_name": "United States",
"latitude": 39.76185,
"longitude": -104.881105,
"timezone": "America/Denver",
"id": "city_ccvrzq54e65m",
"deep": {
"capital_of": "state",
"elevation": 1612,
"elevation_ft": 5289,
"population": 729019,
"population_period": null,
"area": 400.74,
"land_area": 396.46,
"water_area": 4.28
}
}Deep fields
- deep.capital_ofstring or null
- country when it is a national capital, state when it is a state or region capital, null otherwise
- deep.elevationinteger or null
- Elevation in meters at the city center
- deep.elevation_ftinteger or null
- Elevation in feet
- deep.populationinteger or null
- Population
- deep.population_periodstring or null
- Observation year or multi-year period for this population estimate (YYYY or YYYY-YYYY). Null when the record has no verified period or population. Never the import date.
- deep.areanumber or null
- Total area in km² (land + water, or the official total)
- deep.land_areanumber or null
- Land area in km² (null when the source publishes total only)
- deep.water_areanumber or null
- Water area in km² (null when the source publishes total only)
Display language
Pass lang with a language tag such as fr, pt-BR, or zh-Hant. Existing country_name and separately sourced state, district or city names when available. A language choice does not imply worldwide translated city coverage.
Omitting lang preserves the original response. Codes, IDs, numeric facts and native-name fields stay unchanged. Missing translations keep their existing source value; unknown values stay null. A preserved name_local may equal the translated name.
Send a chosen browser preference explicitly, for example { lang: navigator.language } in your JavaScript SDK options. The API does not read Accept-Language automatically. Unsupported regions fall back to their supported base language; unsupported languages or scripts use English. Empty, invalid or repeated tags return 400.
Content-Language identifies languages used in translated display fields and known English fallbacks. This option follows the current API contract. Requests selecting frozen 1.0.0 retain that contract. Select API 2.0.0 to use display language.
41 display language choices
| Language tag | Language |
|---|---|
| en | American English |
| zh-Hans | 简体中文 |
| fr | français (France) |
| de | Deutsch |
| it | italiano |
| ja | 日本語 |
| ko | 한국어 |
| es | español de España |
| ar | العربية |
| bg | български |
| ca | català |
| hr | hrvatski |
| cs | čeština |
| da | dansk |
| nl | Nederlands |
| fi | suomi |
| el | Ελληνικά |
| he | עברית |
| hi | हिन्दी |
| hu | magyar |
| id | Indonesia |
| kk | қазақ тілі |
| ms | Melayu |
| nb | norsk bokmål |
| pl | polski |
| pt | português (Brasil) |
| ro | română |
| ru | русский |
| sk | slovenčina |
| sv | svenska |
| th | ไทย |
| tr | Türkçe |
| uk | українська |
| vi | Tiếng Việt |
| zh-Hant | 繁體中文 |
| en-AU | Australian English |
| en-GB | British English |
| fr-CA | français canadien |
| es-419 | español latinoamericano |
| pt-PT | português europeu |
| zh-Hant-HK | 繁體中文(中國香港特別行政區) |
Build with City
All tutorials →Questions? Email