- [HTTP request](https://docs.cloud.google.com/gemini-enterprise-cx/insights/reference/rest/v1alpha1/projects.locations/generativeInsights.md.txt#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/gemini-enterprise-cx/insights/reference/rest/v1alpha1/projects.locations/generativeInsights.md.txt#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/gemini-enterprise-cx/insights/reference/rest/v1alpha1/projects.locations/generativeInsights.md.txt#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/gemini-enterprise-cx/insights/reference/rest/v1alpha1/projects.locations/generativeInsights.md.txt#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/gemini-enterprise-cx/insights/reference/rest/v1alpha1/projects.locations/generativeInsights.md.txt#body.response_body)
- [Authorization scopes](https://docs.cloud.google.com/gemini-enterprise-cx/insights/reference/rest/v1alpha1/projects.locations/generativeInsights.md.txt#body.aspect)
- [IAM Permissions](https://docs.cloud.google.com/gemini-enterprise-cx/insights/reference/rest/v1alpha1/projects.locations/generativeInsights.md.txt#body.aspect_1)
- [Try it!](https://docs.cloud.google.com/gemini-enterprise-cx/insights/reference/rest/v1alpha1/projects.locations/generativeInsights.md.txt#try-it)

Natural language based Insights which powers the next generation of dashboards in Insights. Next generation of locations.queryMetrics.

### HTTP request

`POST https://{endpoint}/v1alpha1/{location=projects/*/locations/*}:generativeInsights`

Where `{endpoint}` is one of the [supported service endpoints](https://docs.cloud.google.com/gemini-enterprise-cx/insights/reference/rest.md.txt#rest_endpoints).

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

### Path parameters

| Parameters ||
|---|---|
| `location` | `string` Required. The location of the data. "projects/{project}/locations/{location}" |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "naturalLanguageQuery": string, "chart": string, "filter": string, "comparisonFilter": string, "sqlQuery": string, "sqlComparisonKey": string, "sessionId": string, "revisionId": string, "userProvidedChartSpec": { object }, "timeZone": string } ``` |

| Fields ||
|---|---|
| `naturalLanguageQuery` | `string` The natural language query specified by the user. If this field is specified, `sqlQuery` will be ignored. |
| `chart` | `string` The full name of the chart resource this request corresponds to. Format: projects/{project}/locations/{location}/dashboards/{dashboard}/charts/{chart} |
| `filter` | `string` Filter for the data that can be specified in addition to the natural language query. Users are encouraged to use this field to populate time-windows. |
| `comparisonFilter` | `string` Optional. Filter for the data that can be specified in addition to the natural language query. This `filter` is specifically used for charts where comparisons are possible. For example, "compare to last month" or "compare to previous quarter". |
| `sqlQuery` | `string` Optional. The SQL query specified by the user. This query must be in BigQuery SQL dialect. The `filter` field will also be ignored, as it is assumed that any filtering is already included in the SQL query. |
| `sqlComparisonKey` | `string` Optional. For charts with comparison, this key will determine the metric that will be compared between the current and another dataset. |
| `sessionId` | `string` Optional. The session id of the conversation. If the session id is not specified, backend will generate a random session id. If the session id is specified, will associate user-provided userQuery with the provided session id. |
| `revisionId` | `string` Optional. The revision id that maps to the state of the chart state revision. When specified, the backend will reload the chart with the sql and visual spec from that revision. |
| `userProvidedChartSpec` | ``object (`Struct` format)`` Optional. The user provided chart spec for the chart. This will be used to override the visual spec generated by the LLM. |
| `timeZone` | `string` Optional. The time zone name from the [IANA Time Zone Database](https://www.iana.org/time-zones) (for example, `"America/Los_Angeles"`) used to group daily time-series results. If empty, or if the name is well-formed but not known to the server, `UTC` is used. Malformed values are rejected with `INVALID_ARGUMENT`. |

### Response body

If successful, the response body contains an instance of `Operation`.

### Authorization scopes

Requires the following OAuth scope:

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

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

### IAM Permissions

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

- `contactcenterinsights.authorizedConversations.list`
- `contactcenterinsights.conversations.list`

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