---
title: "autocomplete(query, callback, options)"
framework: mapkitjs
role: symbol
role_heading: Instance Method
path: mapkitjs/search/autocomplete1
---

# autocomplete(query, callback, options)

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

## Declaration

```data
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 doc://com.apple.mapkitjs/documentation/MapKitJS/SearchAutocompleteOptions hash, you have the option to constrain the search to a desired area using the doc://com.apple.mapkitjs/documentation/MapKitJS/SearchConstructorOptions/coordinate or doc://com.apple.mapkitjs/documentation/MapKitJS/SearchConstructorOptions/region properties. A coordinate or region you supply here overrides the same property you supply to the doc://com.apple.mapkitjs/documentation/MapKitJS/Search constructor. You also have the option to override the doc://com.apple.mapkitjs/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 doc://com.apple.mapkitjs/documentation/MapKitJS/SearchAutocompleteOptions.

## Return Value

Return Value A promise that resolves when the autocomplete request completes.

## Discussion

Discussion To provide the user with a menu of search suggestions, invoke the autocomplete(query, callback, options) 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 object. The system doesn’t call the callback function or delegate if you cancel the request before MapKit JS receives a response.

## See Also

### Deprecated

- [cancel(promise)](mapkitjs/service/cancel.md)
- [RegionPriority](mapkitjs/search/regionpriority-data.var.md)
- [search(query, callback, options)](mapkitjs/search/search1.md)
