---
type: api
title: Explain the lifecycle state
description: Get the current lifecycle status for one or more indices.
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/operation/operation-ilm-explain-lifecycle
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/operation/operation-ilm-explain-lifecycle
products:
  - Elasticsearch
---

# Explain the lifecycle state

Availability: Generally available since 6.6

## Paths

- `GET` `/{index}/_ilm/explain`

#### Path parameters

- `index` (string) — required
  Comma-separated list of data streams, indices, and aliases to target. Supports wildcards (`*`).
To target all data streams and indices, use `*` or `_all`.

## Description

Get the current lifecycle status for one or more indices.
For data streams, the API retrieves the current lifecycle status for the stream's backing indices.

The response indicates when the index entered each lifecycle state, provides the definition of the running phase, and information about any failures.

[About explaining lifecycle state](https://www.elastic.co/docs/reference/elasticsearch/rest-apis/explain-lifecycle)

## Required authorization

- Index privileges: `view_index_metadata`, `manage_ilm`

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

- `only_errors` (boolean) — optional
  Filters the returned indices to only indices that are managed by ILM and are in an error state, either due to an encountering an error while executing the policy, or attempting to use a policy that does not exist.
- `only_managed` (boolean) — optional
  Filters the returned indices to only indices that are managed by ILM.
- `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.

## Response

`application/json`

- `indices` (map string to oneOf)
## Code examples

#### Console

```console
GET .ds-timeseries-*/_ilm/explain
```

#### JavaScript

```javascript
const response = await client.ilm.explainLifecycle({
  index: ".ds-timeseries-*",
});
```

#### Python

```python
resp = client.ilm.explain_lifecycle(
    index=".ds-timeseries-*",
)
```

#### curl

```curl
curl -X GET "$ELASTICSEARCH_URL/.ds-timeseries-*/_ilm/explain" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.ilm().explainLifecycle(e -> e
    .index(".ds-timeseries-*")
);
```

#### PHP

```php
$resp = $client->ilm()->explainLifecycle([
    "index" => ".ds-timeseries-*",
]);
```

#### Ruby

```ruby
response = client.ilm.explain_lifecycle(
  index: ".ds-timeseries-*"
)
```

## Response examples

#### Explain lifecycle response example1

A successful response when retrieving the current ILM status for an index.

```json
{
  "indices": {
    "my-index-000001": {
      "index": "my-index-000001",
      "index_creation_date_millis": 1538475653281,
      "index_creation_date": "2018-10-15T13:45:21.981Z",
      "time_since_index_creation": "15s",
      "managed": true,
      "policy": "my_policy",
      "lifecycle_date_millis": 1538475653281,
      "lifecycle_date": "2018-10-15T13:45:21.981Z",
      "age": "15s",
      "phase": "new",
      "phase_time_millis": 1538475653317,
      "phase_time": "2018-10-15T13:45:22.577Z",
      "action": "complete"
      "action_time_millis": 1538475653317,
      "action_time": "2018-10-15T13:45:22.577Z",
      "step": "complete",
      "step_time_millis": 1538475653317,
      "step_time": "2018-10-15T13:45:22.577Z"
    }
  }
}
```

