Autocomplete
Typeahead suggestions optimized for speed. Returns in under 20ms.
GET
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
q | string | Required | Search query (minimum 2 characters) |
country | string | Optional | Filter by ISO2 country code |
limit | integer | Optional | Maximum results (default: 5, max: 10) |
Request Example
curl "https://api.localityapi.com/v1/autocomplete?q=Dub&country=AE" \
-H "X-API-Key: lapi_your_key"Response
json
{
"suggestions": [
{
"name": "Dubai",
"country": "AE",
"lat": 25.2048,
"lng": 55.2708
}
],
"query_ms": 4
}Response Fields
suggestionsarrayArray of matching suggestionssuggestions[].namestringPlace namesuggestions[].countrystringISO2 country codesuggestions[].latnumberLatitudesuggestions[].lngnumberLongitudequery_msintegerQuery execution time in milliseconds