---
type: api
title: Get snapshot lifecycle management statistics
description: Get global and policy-level statistics about actions taken by snapshot lifecycle management.
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/operation/operation-slm-get-stats
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/operation/operation-slm-get-stats
products:
  - Elasticsearch
---

# Get snapshot lifecycle management statistics

Availability: Generally available since 7.5

## Paths

- `GET` `/_slm/stats`

## Description

Get global and policy-level statistics about actions taken by snapshot lifecycle management.

## Required authorization

- Cluster privileges: `manage_slm`

## Authentication

- Api key: `Authorization: <value>`
  Elasticsearch APIs support key-based authentication.
  You must create an API key and use the encoded value in the request header.
  For example:
  
  
  ```
  curl -X GET "${ES_URL}/_cat/indices?v=true" \
    -H "Authorization: ApiKey ${API_KEY}"
  ```
  
  To get API keys, use the `/_security/api_key` APIs.
- Basic: `Authorization: Basic <credentials>`
- Bearer: `Authorization: Bearer <token>`
  Elasticsearch APIs support the use of bearer tokens in the `Authorization` HTTP header to authenticate with the API.
  For examples, refer to [Token-based authentication services](https://www.elastic.co/docs/deploy-manage/users-roles/cluster-or-deployment-auth/token-based-authentication-services)

## Query string parameters

- `master_timeout` (string · default: 30s) — optional
  Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.
- `timeout` (string · default: 30s) — optional
  Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

## Response

`application/json`

- `retention_deletion_time` (string)
- `retention_deletion_time_millis` (number)
- `retention_failed` (number)
- `retention_runs` (number)
- `retention_timed_out` (number)
- `total_snapshots_deleted` (number)
- `total_snapshot_deletion_failures` (number)
- `total_snapshots_failed` (number)
- `total_snapshots_taken` (number)
- `policy_stats` (object[])
  - `policy` (string)
  - `snapshots_taken` (number)
  - `snapshots_failed` (number)
  - `snapshots_deleted` (number)
  - `snapshot_deletion_failures` (number)
## Code examples

#### Console

```console
GET /_slm/stats
```

#### JavaScript

```javascript
const response = await client.slm.getStats();
```

#### Python

```python
resp = client.slm.get_stats()
```

#### curl

```curl
curl -X GET "$ELASTICSEARCH_URL/_slm/stats" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.slm().getStats(g -> g);
```

#### C#

```c#
var response = await client.SnapshotLifecycleManagement.GetStatsAsync();
```

#### PHP

```php
$resp = $client->slm()->getStats();
```

#### Ruby

```ruby
response = client.slm.get_stats
```

## Response examples

#### Get snapshot lifecycle management stats response example1

A successful response from `GET /_slm/stats`.

```json
{
  "retention_runs": 13,
  "retention_failed": 0,
  "retention_timed_out": 0,
  "retention_deletion_time": "1.4s",
  "retention_deletion_time_millis": 1404,
  "policy_stats": [ ],
  "total_snapshots_taken": 1,
  "total_snapshots_failed": 1,
  "total_snapshots_deleted": 0,
  "total_snapshot_deletion_failures": 0
}
```

