Search
Search cities and places by name with fuzzy matching and optional country filtering.
GET
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
q | string | Required | Search query (city name) |
country | string | Optional | Filter by ISO2 country code (e.g., AE, US, GB) |
limit | integer | Optional | Maximum results to return (default: 10, max: 100) |
type | string | Optional | Filter by place type (city, town, village) |
Request Example
curl "https://api.localityapi.com/v1/search?q=Dubai&country=AE" \
-H "X-API-Key: lapi_your_key"Response
json
{
"results": [
{
"name": "Dubai",
"country": "AE",
"admin1": "Dubai",
"lat": 25.2048,
"lng": 55.2708,
"timezone": "Asia/Dubai",
"population": 3790000
}
],
"count": 1,
"query_ms": 8
}Response Fields
resultsarrayArray of matching placesresults[].namestringPlace nameresults[].countrystringISO2 country coderesults[].admin1stringPrimary admin region (state/province)results[].latnumberLatituderesults[].lngnumberLongituderesults[].timezonestringIANA timezone identifierresults[].populationintegerPopulation countcountintegerTotal number of resultsquery_msintegerQuery execution time in milliseconds