LocalityAPI
Get API Key

Autocomplete

Typeahead suggestions optimized for speed. Returns in under 20ms.

GET

Parameters

ParameterTypeRequiredDescription
qstringRequiredSearch query (minimum 2 characters)
countrystringOptionalFilter by ISO2 country code
limitintegerOptionalMaximum 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 suggestions
suggestions[].namestringPlace name
suggestions[].countrystringISO2 country code
suggestions[].latnumberLatitude
suggestions[].lngnumberLongitude
query_msintegerQuery execution time in milliseconds