<!--
{
  "availability" : [
    "MapKit JS: 5.0.0 - 6.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "MapKitJS",
  "identifier" : "/documentation/MapKitJS/Search/autocomplete1",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "MapKit JS"
    ],
    "preciseIdentifier" : "instm/mapkit.Search/autocomplete1"
  },
  "title" : "autocomplete(query, callback, options)"
}
-->

# autocomplete(query, callback, options)

Retrieves a list of autocomplete results for the specified search query.

```
autocomplete(
    query: string,
    callback: SearchDelegate<SearchAutocompleteResponse>,
    options?: SearchAutocompleteOptions,
): Promise<SearchAutocompleteResponse>;
```

## Parameters

`query`

A string that represents the user’s search in progress.

`callback`

A callback function or delegate object.

`options`

With the [`SearchAutocompleteOptions`](/documentation/MapKitJS/SearchAutocompleteOptions) hash, you have the option to constrain the search to a desired area using the [`coordinate`](/documentation/MapKitJS/SearchConstructorOptions/coordinate) or [`region`](/documentation/MapKitJS/SearchConstructorOptions/region) properties. A coordinate or region you supply here overrides the same property you supply to the [`Search`](/documentation/MapKitJS/Search) constructor. You also have the option to override the [`language`](/documentation/MapKitJS/Service/language) for the search constructor. For example, `{ "language: "fr-CA" }` tells the server to send results localized to Canadian French. For a complete list of options you can use to constrain your search, see [`SearchAutocompleteOptions`](/documentation/MapKitJS/SearchAutocompleteOptions).

## Return Value

A promise that resolves when the autocomplete request completes.

## Discussion

To provide the user with a menu of search suggestions, invoke the [`autocomplete(query, callback, options)`](/documentation/MapKitJS/Search/autocomplete1) method as users type. This method minimizes typing and brings users the results they’re looking for.

MapKit JS invokes the `callback` function on failure and success with two arguments, `error` and `data`:

- `error`. An error object that contains an error code and descriptive message.
- `data`. A [`SearchAutocompleteResponse`](/documentation/MapKitJS/SearchAutocompleteResponse) object.

The system doesn’t call the callback function or delegate if you cancel the request before MapKit JS receives a response.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)