- [HTTP request](https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#body.HTTP_TEMPLATE)
- [Path parameters](https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#body.PATH_PARAMETERS)
- [Request body](https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#body.request_body)
  - [JSON representation](https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#body.response_body)
  - [JSON representation](https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#body.ChatResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#body.aspect)
- [ResponseBlock](https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#ResponseBlock)
  - [JSON representation](https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#ResponseBlock.SCHEMA_REPRESENTATION)
- [DataTable](https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#DataTable)
  - [JSON representation](https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#DataTable.SCHEMA_REPRESENTATION)
- [DataTableHeader](https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#DataTableHeader)
  - [JSON representation](https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#DataTableHeader.SCHEMA_REPRESENTATION)
- [DataTableRow](https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#DataTableRow)
  - [JSON representation](https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#DataTableRow.SCHEMA_REPRESENTATION)
- [DataTableCell](https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#DataTableCell)
  - [JSON representation](https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#DataTableCell.SCHEMA_REPRESENTATION)
- [PropertyChatQuota](https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#PropertyChatQuota)
  - [JSON representation](https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#PropertyChatQuota.SCHEMA_REPRESENTATION)
- [Try it!](https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#try-it)

Provides a chat interface for interacting with Google Analytics data through the API.

This product uses AI and may display inaccurate info. Your chat activity may be used to improve the product and your use is subject to Google's [Terms](https://policies.google.com/terms), [AI Use Policy](https://policies.google.com/terms/generative-ai/use-policy), and [Privacy Policy](https://policies.google.com/privacy). [Learn more about properties.chat AI Privacy](https://support.google.com/helpguide/answer/14185196).

### HTTP request

`POST https://analyticsdata.googleapis.com/v1alpha/{property=properties/*}:chat`

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

### Path parameters

| Parameters ||
|---|---|
| `property` | `string` Required. The property to chat about. Format: properties/{property} |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "userQuery": string, "returnPropertyQuota": boolean, "sessionId": string } ``` |

| Fields ||
|---|---|
| `userQuery` | `string` Required. The user's query. |
| `returnPropertyQuota` | `boolean` Optional. If true, the response will include the current state of this Analytics Property's quota. Quota is returned in [PropertyChatQuota](https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#PropertyChatQuota). |
| `sessionId` | `string` Optional. Provide this session ID to continue an existing conversation and maintain context. If this field is empty or unset, a new chat session is created. Invalid session IDs will result in an error. |

### Response body

Response message for the properties.chat method.

If successful, the response body contains data with the following structure:

| JSON representation |
|---|
| ``` { "sessionId": string, "blocks": [ { object (`https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#ResponseBlock`) } ], "propertyQuota": { object (`https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#PropertyChatQuota`) } } ``` |

| Fields ||
|---|---|
| `sessionId` | `string` The unique identifier for this chat session. Provide this ID in subsequent requests to maintain conversational context. |
| `blocks[]` | ``object (`https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#ResponseBlock`)`` The response blocks that make up the chat response. This can include text, tables, and lists. |
| `propertyQuota` | ``object (`https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#PropertyChatQuota`)`` This Analytics Property's quota state including this request. |

### Authorization scopes

Requires the following OAuth scope:

- `https://www.googleapis.com/auth/analytics.chatbot.read`

## ResponseBlock

One block of structured data in chat response.

| JSON representation |
|---|
| ``` { // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "text": string, "table": { object (`https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#DataTable`) } // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| One block of structured data. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `text` | `string` A block of text. |
| `table` | ``object (`https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#DataTable`)`` A block of table data. |
| End of mutually exclusive fields. ||

## DataTable

A table of data.

| JSON representation |
|---|
| ``` { "headers": [ { object (`https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#DataTableHeader`) } ], "rows": [ { object (`https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#DataTableRow`) } ] } ``` |

| Fields ||
|---|---|
| `headers[]` | ``object (`https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#DataTableHeader`)`` Describes dimension columns. The number of headers and ordering of headers matches the dimensions present in rows. |
| `rows[]` | ``object (`https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#DataTableRow`)`` Rows of dimension value combinations and metric values in the report. |

## DataTableHeader

Describes a column header in a DataTable.

| JSON representation |
|---|
| ``` { "header": string, "dataType": string } ``` |

| Fields ||
|---|---|
| `header` | `string` The header name. |
| `dataType` | `string` The data type. |

## DataTableRow

A row in a DataTable.

| JSON representation |
|---|
| ``` { "columns": [ { object (`https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#DataTableCell`) } ] } ``` |

| Fields ||
|---|---|
| `columns[]` | ``object (`https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/chat#DataTableCell`)`` The cell values in the row. |

## DataTableCell

A cell in a data table.

| JSON representation |
|---|
| ``` { "value": string } ``` |

| Fields ||
|---|---|
| `value` | `string` The value of the cell. |

## PropertyChatQuota

Property quota for chatbot specific fields.

| JSON representation |
|---|
| ``` { "tokensPerDay": { object (`https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/QuotaStatus`) }, "tokensPerHour": { object (`https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/QuotaStatus`) } } ``` |

| Fields ||
|---|---|
| `tokensPerDay` | ``object (`https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/QuotaStatus`)`` properties.chat tokens consumed per day. |
| `tokensPerHour` | ``object (`https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/QuotaStatus`)`` properties.chat tokens consumed per hour. |