Autocomplete
Search cities, states and countries by name.
Subscribe on RapidAPIGET /places/v1/autocomplete
Parameters
| Parameter | Required | Default | Meaning |
|---|---|---|---|
q | Yes | Search text, 1-100 characters. Surrounding whitespace is ignored. | |
type | No | all types | city, state (state, province or region) or country. |
country_code | No | all countries | Two-letter country code, case-insensitive. |
limit | No | 10 | Number of suggestions, 1-50. |
Matching
- Prefix match: a place matches when its name starts with
q.sanmatches San Diego and Santa Clara, not Lausanne. - Case-insensitive:
SAN,Sanandsangive the same results. - Accents matter:
sãomatches São Paulo,saodoes not. - No match is not an error: you get
200with an emptyresultsarray.
Ordering
- Name, alphabetically. An exact match always comes first (
georgiareturns Georgia before Georgiana). - For the same name: countries, then states, then cities.
- Then by
display_name.
Duplicate records of the same place are returned once. Different places can share a label (for example two towns with the same name in the same state); they are returned separately with their own coordinates.
Result fields
| Field | Type | Meaning |
|---|---|---|
id | string | Stable identifier, prefixed with the type (city:…, state:…, country:…) |
type | string | city, state or country |
name | string | Place name |
display_name | string | Label for display: name, state (for cities) and country |
country_code | string | Two-letter country code |
country_name | string | Country name |
state_name | string or null | State or region; null for countries |
latitude, longitude | string or null | Decimal degrees, as strings |
timezone | string or null | IANA time zone, for example Asia/Kolkata |
currency_code | string or null | ISO 4217 currency of the country |
Missing values are always null; fields are never omitted.