---
type: api
title: Get lifecycle policies
description: **All methods and paths for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/operation/operation-ilm-get-lifecycle
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/operation/operation-ilm-get-lifecycle
products:
  - Elasticsearch
---

# Get lifecycle policies


Availability: 6.6+

## Paths

- `GET` `/_ilm/policy/{policy}`
- `GET` `/_ilm/policy`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/authentication#basicauth)
- [Bearer auth](/elastic/docs-builder/docs/4371/api/doc/elasticsearch/v9/authentication#bearerauth)

#### Path Parameters

- `policy` (string Name) — optional, leave it out to use `/_ilm/policy`
  Identifier for the policy.

## Description

## Required authorization

* Cluster privileges: `manage_ilm`,`read_ilm`

## Query String Parameters

- `master_timeout` (string Duration · default: 30s)
  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 Duration · default: 30s)
  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`

Type: `map string to Lifecycle`

## Code Examples

#### Console

```console
GET _ilm/policy/my_policy
```

#### JavaScript

```javascript
const response = await client.ilm.getLifecycle({
  name: "my_policy",
});
```

#### Python

```python
resp = client.ilm.get_lifecycle(
    name="my_policy",
)
```

#### curl

```curl
curl -X GET "$ELASTICSEARCH_URL/_ilm/policy/my_policy" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.ilm().getLifecycle(g -> g
    .name("my_policy")
);
```

#### C#

```c#
var response = await client.IndexLifecycleManagement
    .GetLifecycleAsync(d1 => d1
        .Name("my_policy")
    );
```

#### PHP

```php
$resp = $client->ilm()->getLifecycle([
    "policy" => "my_policy",
]);
```

#### Ruby

```ruby
response = client.ilm.get_lifecycle(
  policy: "my_policy"
)
```

## Response Examples

#### Get lifecycle response example1

A successful response when retrieving a lifecycle policy.

```json
{
  "my_policy": {
    "version": 1,
    "modified_date": 82392349,
    "policy": {
      "phases": {
        "warm": {
          "min_age": "10d",
          "actions": {
            "forcemerge": {
              "max_num_segments": 1
            }
          }
        },
        "delete": {
          "min_age": "30d",
          "actions": {
            "delete": {
              "delete_searchable_snapshot": true
            }
          }
        }
      }
    },
    "in_use_by" : {
      "indices" : [],
      "data_streams" : [],
      "composable_templates" : []
    }
  }
}
```

