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

# autocomplete(query, options)

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

## Declaration

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

## Parameters

- `query`: A string that represents the user’s search in progress.
- `options`: Options for this specific query that supersede values set on the doc://com.apple.mapkitjs/documentation/MapKitJS/Search object. See doc://com.apple.mapkitjs/documentation/MapKitJS/SearchAutocompleteOptions.

## Return Value

Return Value A promise that resolves with a SearchAutocompleteResponse on success, or rejects with an Error on failure.

## Discussion

Discussion To provide the user with a menu of search suggestions, invoke the autocomplete(query, options) method as users type. This method minimizes typing and brings users the results they’re looking for. Pass an AbortSignal from an AbortController to the signal option to allow the controller to cancel a pending request. When the controller aborts, the promise it returns rejects with a DOMException whose name is "AbortError".

## See Also

### Performing a search autocomplete

- [SearchAutocompleteOptions](mapkitjs/searchautocompleteoptions.md)
- [SearchAutocompleteResponse](mapkitjs/searchautocompleteresponse.md)
- [SearchAutocompleteResult](mapkitjs/searchautocompleteresult.md)
