---
title: "Autocomplete"
method: GET
path: "/autocomplete"
tags: ["Autocomplete"]
---

# Autocomplete

`GET /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.

<a href="https://locationiq.com/demo#autocomplete" target="_blank">Try this API in our Playground</a>

> If you use Leaflet for your maps, you add LocationIQ's Autocomplete as a plugin instantly! You can <a href="https://github.com/location-iq/leaflet-geocoder" target="_blank">view instructions here</a>. You can also view a <a href="https://maps.locationiq.com" target="_blank">live demo here</a>.

> 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 `region` similar to other LocationIQ endpoints, but in the interest of end-user experience, we don't recommended such a configuration.

## Query parameters

- `q` string, required
- `countrycodes` string
- `tag` string
- `layers` string
- `limit` integer
- `viewbox` string
- `bounded` 0 | 1
- `json_callback` string
- `normalizecity` 0 | 1
- `accept-language` string
- `statecode` 0 | 1
- `importancesort` 0 | 1
- `dedupe` 0 | 1

## Response `200`

OK

- object[]
  - `place_id` string — Unique identifier for the place.
  - `osm_id` string — Unique identifier for the OpenStreetMap object.
  - `osm_type` string — Type of OpenStreetMap object.
  - `licence` string — License information for the data.
  - `lat` string — Latitude of the location.
  - `lon` string — Longitude of the location.
  - `boundingbox` string[] — List of bounding box coordinates [min_lat, max_lat, min_lon, max_lon].
  - `class` string — The category of this result
  - `type` string — The 'type' of the class/category of this result
  - `display_name` string — Formatted address for display.
  - `display_place` string — Only the name part of the address; if the `type` is a `city`, just the city's name. If the `type` is `highway`, just the road's name. This is helpful when a client library wants to display this information separately.
  - `display_address` string — The complete address without the text already present in `display_place`.
  - `address` AddressAutocomplete — Breakdown of the address into elements. All these elements are optional and only those elements that are available for a given location will be returned.
    - `name` string — House name or Point of Interest (POI)
    - `house_number` string — House or Building number
    - `road` string — Roads, Highways, Freeways, Motorways
    - `neighbourhood` string — Neighbourhoods, Allotments, Quarters, Communities
    - `suburb` string — Suburbs, Subdivisions
    - `city` string — Cities, Towns, Villages, Municipalities, Districts, Boroughs, Hamlets
    - `county` string — Counties
    - `state` string — States, Provinces, Regions, State Districts
    - `state_code` string — State or Province Code
    - `postcode` string — Postal Codes, Zipcodes
    - `country` string — Countries, Nation-states
    - `country_code` string — Country Code - 2 letter (ISO 3166-1 alpha-2)

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — The request has been made from an unauthorized domain.
- `404` — No location or places were found for the given input.
- `429` — Request exceeded the rate-limits set on your account.
- `500` — Internal Server Error

---

[API](https://skmtc.dev/locationiq/apis/locationiq-api-reference.md) · [All operations](https://skmtc.dev/locationiq/apis/locationiq-api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/locationiq/locationiq-api-reference/revisions/62f2eab3d1ff/schema)
