- [HTTP request](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2beta1/projects.suggestions/searchKnowledge#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2beta1/projects.suggestions/searchKnowledge#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2beta1/projects.suggestions/searchKnowledge#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2beta1/projects.suggestions/searchKnowledge#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2beta1/projects.suggestions/searchKnowledge#body.response_body)
- [Authorization scopes](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2beta1/projects.suggestions/searchKnowledge#body.aspect)
- [Try it!](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2beta1/projects.suggestions/searchKnowledge#try-it)

Get answers for the given query based on knowledge documents.

### HTTP request

Choose an endpoint:
global   
`POST https://dialogflow.googleapis.com/v2beta1/{parent=projects/*}/suggestions:searchKnowledge`

<br />

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

**OR**

`POST https://{endpoint}/v2beta1/{parent=projects/*}/suggestions:searchKnowledge`

Where `{endpoint}` is one of the [supported service endpoints](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest#rest_endpoints).

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

### Path parameters

| Parameters ||
|---|---|
| `parent` | `string` Required. The parent resource contains the conversation profile Format: 'projects/' or `projects/<Project ID>/locations/<Location ID>`. |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "query": { object (`https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2beta1/TextInput`) }, "conversationProfile": string, "sessionId": string, "conversation": string, "latestMessage": string, "querySource": enum (`https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2beta1/QuerySource`), "endUserMetadata": { object }, "searchConfig": { object (`https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2beta1/SearchConfig`) }, "exactSearch": boolean } ``` |

| Fields ||
|---|---|
| `query` | ``object (`https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2beta1/TextInput`)`` Required. The natural language text query for knowledge search. |
| `conversationProfile` | `string` Required. The conversation profile used to configure the search. Format: `projects/<Project ID>/locations/<Location ID>/conversationProfiles/<Conversation Profile ID>`. |
| `sessionId` | `string` Required. The ID of the search session. The sessionId can be combined with Dialogflow V3 Agent ID retrieved from conversation profile or on its own to identify a search session. The search history of the same session will impact the search result. It's up to the API caller to choose an appropriate `Session ID`. It can be a random number or some type of session identifiers (preferably hashed). The length must not exceed 36 characters. |
| `conversation` | `string` Optional. The conversation (between human agent and end user) where the search request is triggered. Format: `projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>`. |
| `latestMessage` | `string` Optional. The name of the latest conversation message when the request is triggered. Format: `projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>/messages/<Message ID>`. |
| `querySource` | ``enum (`https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2beta1/QuerySource`)`` Optional. The source of the query in the request. |
| `endUserMetadata` | ``object (`https://protobuf.dev/reference/protobuf/google.protobuf#struct` format)`` Optional. Information about the end-user to improve the relevance and accuracy of generative answers. This will be interpreted and used by a language model, so, for good results, the data should be self-descriptive, and in a simple structure. Example: { "subscription plan": "Business Premium Plus", "devices owned": [ {"model": "Google Pixel 7"}, {"model": "Google Pixel Tablet"} ] } |
| `searchConfig` | ``object (`https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2beta1/SearchConfig`)`` Optional. Configuration specific to search queries with data stores. |
| `exactSearch` | `boolean` Optional. Whether to search the query exactly without query rewrite. |

### Response body

If successful, the response body contains an instance of `https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2beta1/SearchKnowledgeResponse`.

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/cloud-platform`
- `
  https://www.googleapis.com/auth/dialogflow`

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