# How to get file names of my Snapshot using curl?

**URL:** <https://discuss.elastic.co/t/how-to-get-file-names-of-my-snapshot-using-curl/310874>\
**Category:** Elasticsearch\
**Tags:** snapshot-and-restore\
**Created:** [July 28, 2022, 1:52pm UTC](https://discuss.elastic.co/t/how-to-get-file-names-of-my-snapshot-using-curl/310874 "2022-07-28T13:52:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wonderland14](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wonderland14/32/102959_2.png) [@wonderland14](https://discuss.elastic.co/u/wonderland14)\
**Post date:** [July 28, 2022, 1:52pm UTC](https://discuss.elastic.co/t/how-to-get-file-names-of-my-snapshot-using-curl/310874/1 "2022-07-28T13:52:08Z")

</div>

Hi Elasticsearch Team! Just wondering if we do have a command to get the list of our snapshot file names using curl?

Scenario:

1. I used the step provided for snapshot and restore " [Restore a snapshot | Elasticsearch Guide [8.3] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/snapshots-restore-snapshot.html#restore-entire-cluster)"
2. Now, on step 7 where I can now restore my Snapshot, I don't have a copy of my snapshot because one of the requirement is to stop and delete everything from Elasticsearch, so I can't see my Snapshot file name on Kibana API because its down, so in order to proceed from step 7 I need the filename of my snapshot.  
Here is the command to run restore(provided on the documentation)

```auto
POST _snapshot/my_repository/my_snapshot_2099.05.06/_restore
{
  "indices": "*",
  "include_global_state": true
}

```

Question: Is it possible to get the list of all snapshot filename?

Thanks Everyone!

---

<div class="post-metadata">

**Author:** ![ropc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ropc/32/47022_2.png) [@ropc](https://discuss.elastic.co/u/ropc)\
**Post date:** [August 7, 2022, 1:15pm UTC](https://discuss.elastic.co/t/how-to-get-file-names-of-my-snapshot-using-curl/310874/2 "2022-08-07T13:15:12Z")

</div>

Hi @wonderland14 ,

> Question: Is it possible to get the list of all snapshot filename?

A couple of options here:

1. If you have been using SLM (Snapshot Lifecycle Management), you can use the [Get snapshot lifecycle policy API](https://www.elastic.co/guide/en/elasticsearch/reference/current/slm-api-get-policy.html). For example:

- `GET _slm/policy` and retrieve the `snapshot_name` in the `last_success` section.

1. You can also use the [cat snapshots API](https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-snapshots.html). For example:

- `GET _cat/snapshots?v` and look for the last `SUCCESSFUL` snapshot.

Let us know if that helps.

---

<div class="post-metadata">

**Author:** ![wonderland14](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wonderland14/32/102959_2.png) [@wonderland14](https://discuss.elastic.co/u/wonderland14)\
**Post date:** [August 7, 2022, 2:09pm UTC](https://discuss.elastic.co/t/how-to-get-file-names-of-my-snapshot-using-curl/310874/3 "2022-08-07T14:09:14Z")

</div>

Thank You!! @ropc , I finally get the Snapshot file name using the GET \_slm/policy 🙂

```auto
{"TestPolicy":{"version":2,"modified_date_millis":1659715231600,"policy":{"name":"snapshot_test","schedule":"0 30 1 * * ?","repository":"Repository_Test","config":{}},"last_success":{"snapshot_name":"snapshot_test-ybe5v0aqq_slurpcnjhebq","start_time":1659835799954,"time":1659835818802},"next_execution_millis":1659922200000,"stats":{"policy":"TestPolicy","snapshots_taken":12,"snapshots_failed":0,"snapshots_deleted":0,"snapshot_deletion_failures":0}}}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 4, 2022, 2:09pm UTC](https://discuss.elastic.co/t/how-to-get-file-names-of-my-snapshot-using-curl/310874/4 "2022-09-04T14:09:15Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
