# Method: stats.getIndex

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

Gets indexed item statistics aggreggated across all data sources. This API only returns statistics for previous dates; it doesn't return statistics for the current day.

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

### HTTP request

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

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`)`` Start of the date range to retrieve statistics for. This value must be within 1 year of the current date. |
| `toDate` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/Date`)`` End of the date range to retrieve statistics for. This value must be within 1 year of the current date and greater than fromDate. |

### 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/getIndex#CustomerIndexStats`) } ], "averageIndexedItemCount": string } ``` |

| Fields ||
|---|---|
| `stats[]` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/stats/getIndex#CustomerIndexStats`)`` Summary of indexed item counts, one for each day in the requested range. |
| `averageIndexedItemCount` | `string (https://developers.google.com/discovery/v1/type-format format)` Average item count for the given date range for which billing is done. |

### 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).

## CustomerIndexStats

Aggregation of items by status code as of the specified date.

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

| Fields ||
|---|---|
| `date` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/Date`)`` The date for which statistics were calculated. |
| `itemCountByStatus[]` | ``object (`https://developers.google.com/workspace/cloud-search/docs/reference/rest/v1/stats.index.datasources#ItemCountByStatus`)`` Number of items aggregrated by status code. |