Search Endpoints
Fuzzy Search
Typo-tolerant search for cities, states, and countries using trigram similarity
GET
Search cities, states, and countries by an approximate query that tolerates misspellings, transliterations, and native-script variants. Unlike the exact/substring inline search (Documentation Index
Fetch the complete documentation index at: https://docs.countrystatecity.in/llms.txt
Use this file to discover all available pages before exploring further.
?q=), fuzzy search ranks results by how similar they are to your query, so Banglore still resolves to Bangalore and Beijng to Beijing.
Matching uses PostgreSQL trigram similarity over both the English name and the native name, returning a match_score so you can decide how confident a hit is.
Availability: Professional plan and above. Returns
403 on Community, Starter, and Supporter plans.Each result is scored against both the English and native names; the higher of the two wins. Responses are cached server-side, keyed by query, type, country filter, limit, threshold, and your plan’s data-access level.
Authentication
Your API key for authentication
Query Parameters
The search text. 2–100 characters. Matched case-insensitively against the English and native names.
What to search. One of
city, state, or country.Restrict results to a single country by ISO 3166-1 alpha-2 code, e.g.
IN, US. Case-insensitive (auto-uppercased). Applies to type=city and type=state only — sending it with type=country returns 400.Maximum number of results to return. 1–50.
Minimum trigram similarity a row must reach to be returned. 0.1–1. Lower values are more permissive (more, looser matches); higher values are stricter. The default
0.3 is a good balance for typo tolerance.Response
Returns an array sorted bymatch_score descending. Each item carries the standard fields for the entity (city, state, or country) at your plan’s data-access level — Professional and Business resolve to the full field set — plus two fuzzy-specific fields:
Trigram similarity of the best-matching name (English or native), from
0 to 1, rounded to 2 decimals. Higher means a closer match.The native name when it scored higher than the English name (e.g. a Devanagari or Han query that matched the local spelling).
null when the English name was the better match.Related Endpoints
- Get All Countries — exact/substring inline search via
?q= - Get Cities by Country — list cities, filterable by
?q= - Lookup Country by ISO Code — resolve a known ISO code to a country