Autocomplete
The Autocomplete API is a variant of the Search API that returns place predictions in response to an HTTP request. The request specifies a textual search string and optional geographic bounds. The service can be used to provide autocomplete functionality for text-based geographic searches, by returning places such as businesses, addresses and points of interest as a user types.
The Autocomplete API can match on full words as well as substrings. Applications can therefore send queries as the user types, to provide on-the-fly place predictions.
Try this API in our Playground
If you use Leaflet for your maps, you add LocationIQ's Autocomplete as a plugin instantly! You can view instructions here. You can also view a live demo here.
The Autocomplete API endpoint (https://api.locationiq.com/v1) offers an Anycast IP address and route user requests to a datacenter closest to them. You can still manually specify a
regionsimilar to other LocationIQ endpoints, but in the interest of end-user experience, we don't recommended such a configuration.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X GET "https://example.com/autocomplete?q=Empire+State+Building"{ "place_id": "321978604508", "osm_id": "34633854", "osm_type": "way", "licence": "https://locationiq.com/attribution", "lat": "40.7484284", "lon": "-73.9856546198733", "boundingbox": [ "40.7479226", "40.7489422", "-73.9864855", "-73.9848259" ], "class": "tourism", "type": "attraction", "display_name": "Empire State Building, 350, 5th Avenue, Korea Town, Midtown South, Manhattan, Manhattan Community Board 5, New York County, New York City, New York, 10001, United States of America", "display_place": "Empire State Building", "display_address": "350, 5th Avenue, Midtown South, New York City, New York, 10001, USA", "address": { "name": "Empire State Building", "house_number": "350", "road": "5th Avenue", "suburb": "Midtown South", "city": "New York City", "state": "New York", "postcode": "10001", "country": "United States of America", "country_code": "us" }}