# Method: stats.getQuery

- [HTTP request](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/stats/getQuery#body.HTTP_TEMPLATE)
- [Query parameters](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/stats/getQuery#body.QUERY_PARAMETERS)
- [Request body](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/stats/getQuery#body.request_body)
- [Response body](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/stats/getQuery#body.response_body)
  - [JSON representation](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/stats/getQuery#body.GetCustomerQueryStatsResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/stats/getQuery#body.aspect)
- [CustomerQueryStats](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/stats/getQuery#CustomerQueryStats)
  - [JSON representation](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/stats/getQuery#CustomerQueryStats.SCHEMA_REPRESENTATION)
- [Try it!](https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/stats/getQuery#try-it)

Get the query statistics for customer.

**Note:** This API requires a standard end user account to execute.

### HTTP request

`GET https://cloudsearch.googleapis.com/v1/stats/query`

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

### Query parameters

| Parameters ||
|---|---|
| `fromDate` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/Date`)`` All available stats from fromDate to toDate are returned. fromDate should be within the year and toDate \>= fromDate. |
| `toDate` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/Date`)`` |

### Request body

The request body must be empty.

### Response body

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

| JSON representation |
|---|
| ``` { "stats": [ { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/stats/getQuery#CustomerQueryStats`) } ], "totalQueryCount": string } ``` |

| Fields ||
|---|---|
| `stats[]` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/stats/getQuery#CustomerQueryStats`)`` |
| `totalQueryCount` | `string (https://developers.google.com/discovery/v1/type-format format)` Total successful query count (status code 200) for the given date range. |

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/cloud_search.stats.indexing`
- `https://www.googleapis.com/auth/cloud_search.stats`
- `https://www.googleapis.com/auth/cloud_search`

For more information, see the [Authorization guide](https://developers.google.com/workspace/guides/configure-oauth-consent).

## CustomerQueryStats

| JSON representation |
|---|
| ``` { "date": { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/Date`) }, "queryCountByStatus": [ { object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/stats.query.searchapplications#QueryCountByStatus`) } ] } ``` |

| Fields ||
|---|---|
| `date` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/Date`)`` The date for which query stats were calculated. Stats calculated on the next day close to midnight are returned. |
| `queryCountByStatus[]` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/stats.query.searchapplications#QueryCountByStatus`)`` |