- [HTTP request](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.completionConfig/completeQuery#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.completionConfig/completeQuery#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.completionConfig/completeQuery#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.completionConfig/completeQuery#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.completionConfig/completeQuery#body.response_body)
- [Authorization scopes](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.completionConfig/completeQuery#body.aspect)
- [IAM Permissions](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.completionConfig/completeQuery#body.aspect_1)

Completes the user input with advanced keyword suggestions.

### HTTP request

Choose an endpoint:
global us   
`POST https://discoveryengine.googleapis.com/v1alpha/{completionConfig=projects/*/locations/*/collections/*/engines/*/completionConfig}:completeQuery`

<br />

The URLs use [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `completionConfig` | `string` Required. The completionConfig of the parent dataStore or engine resource name for which the completion is performed, such as `projects/*/locations/global/collections/default_collection/dataStores/*/completionConfig` `projects/*/locations/global/collections/default_collection/engines/*/completionConfig`. |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "query": string, "queryModel": string, "userPseudoId": string, "userInfo": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/UserInfo`) }, "includeTailSuggestions": boolean, "boostSpec": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/BoostSpec`) }, "suggestionTypes": [ enum (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/SuggestionType`) ], "suggestionTypeSpecs": [ { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/SuggestionTypeSpec`) } ], "experimentIds": [ string ] } ``` |

| Fields ||
|---|---|
| `query` | `string` Required. The typeahead input used to fetch suggestions. Maximum length is 128 characters. The query can not be empty for most of the suggestion types. If it is empty, an `INVALID_ARGUMENT` error is returned. The exception is when the suggestionTypes contains only the type `RECENT_SEARCH`, the query can be an empty string. The is called "zero prefix" feature, which returns user's recently searched queries given the empty query. |
| `queryModel` | `string` Specifies the autocomplete query model, which only applies to the QUERY SuggestionType. This overrides any model specified in the Configuration \> Autocomplete section of the Cloud console. Currently supported values: - `document` - Using suggestions generated from user-imported documents. - `search-history` - Using suggestions generated from the past history of `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.dataStores.servingConfigs/search#google.cloud.discoveryengine.v1alpha.SearchService.Search` API calls. Do not use it when there is no traffic for Search API. - `user-event` - Using suggestions generated from user-imported search events. - `document-completable` - Using suggestions taken directly from user-imported document fields marked as completable. Default values: - `document` is the default model for regular dataStores. - `search-history` is the default model for site search dataStores. |
| `userPseudoId` | `string` Optional. A unique identifier for tracking visitors. For example, this could be implemented with an HTTP cookie, which should be able to uniquely identify a visitor on a single device. This unique identifier should not change if the visitor logs in or out of the website. This field should NOT have a fixed value such as `unknown_visitor`. This should be the same identifier as `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.dataStores.userEvents#UserEvent.FIELDS.user_pseudo_id` and `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.evaluations#SearchRequest.FIELDS.user_pseudo_id`. The field must be a UTF-8 encoded string with a length limit of 128 |
| `userInfo` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/UserInfo`)`` Optional. Information about the end user. This should be the same identifier information as `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.dataStores.userEvents#UserEvent.FIELDS.user_info` and `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.evaluations#SearchRequest.FIELDS.user_info`. |
| `includeTailSuggestions` | `boolean` Indicates if tail suggestions should be returned if there are no suggestions that match the full query. Even if set to true, if there are suggestions that match the full query, those are returned and no tail suggestions are returned. |
| `boostSpec` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/BoostSpec`)`` Optional. Specification to boost suggestions matching the condition. |
| `suggestionTypes[]` | ``enum (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/SuggestionType`)`` Optional. Suggestion types to return. If empty or unspecified, query suggestions are returned. Only one suggestion type is supported at the moment. |
| `suggestionTypeSpecs[]` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/SuggestionTypeSpec`)`` Optional. Specification of each suggestion type. |
| `experimentIds[]` | `string` Optional. experiment ids for this request. |

### Response body

If successful, the response body contains an instance of `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/AdvancedCompleteQueryResponse`.

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/cloud-platform`
- `https://www.googleapis.com/auth/cloud_search.query`
- `https://www.googleapis.com/auth/discoveryengine.assist.readwrite`
- `https://www.googleapis.com/auth/discoveryengine.complete_query`
- `https://www.googleapis.com/auth/discoveryengine.readwrite`
- `https://www.googleapis.com/auth/discoveryengine.serving.readwrite`

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).

### IAM Permissions

Requires the following [IAM](https://cloud.google.com/iam/docs) permission on the `completionConfig` resource:

- `discoveryengine.completionConfigs.completeQuery`

For more information, see the [IAM documentation](https://cloud.google.com/iam/docs).