---
type: api
title: Clone a snapshot
description: Clone part of all of a snapshot into another snapshot in the same repository.
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/v8/operation/operation-snapshot-clone
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch/v8/operation/operation-snapshot-clone
products:
  - Elasticsearch
---

# Clone a snapshot

Availability: Generally available since 7.10

## Paths

- `PUT` `/_snapshot/{repository}/{snapshot}/_clone/{target_snapshot}`

#### Path parameters

- `repository` (string) — required
  The name of the snapshot repository that both source and target snapshot belong to.
- `snapshot` (string) — required
  The source snapshot name.
- `target_snapshot` (string) — required
  The target snapshot name.

## Description

Clone part of all of a snapshot into another snapshot in the same repository.

## Required authorization

- Cluster privileges: `manage`

## 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/guide/en/elasticsearch/reference/current/token-authentication-services.html)

## Query string parameters

- `master_timeout` (string · default: 30s) — optional
  The period to wait for the master node.
If the master node is not available before the timeout expires, the request fails and returns an error.
To indicate that the request should never timeout, set it to `-1`.

## Request body

`application/json`

- `indices` (string) — required
  A comma-separated list of indices to include in the snapshot.
Multi-target syntax is supported.

## Response

`application/json`

- `acknowledged` (boolean)
  For a successful response, this value is always true. On failure, an exception is returned instead.
## Code examples

#### Console

```console
PUT /_snapshot/my_repository/source_snapshot/_clone/target_snapshot
{
  "indices": "index_a,index_b"
}
```

#### JavaScript

```javascript
const response = await client.snapshot.clone({
  repository: "my_repository",
  snapshot: "source_snapshot",
  target_snapshot: "target_snapshot",
  indices: "index_a,index_b",
});
```

#### Python

```python
resp = client.snapshot.clone(
    repository="my_repository",
    snapshot="source_snapshot",
    target_snapshot="target_snapshot",
    indices="index_a,index_b",
)
```

#### curl

```curl
curl -X PUT "$ELASTICSEARCH_URL/_snapshot/my_repository/source_snapshot/_clone/target_snapshot" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "indices": "index_a,index_b"
  }'
```

#### Java

```java
client.snapshot().clone(c -> c
    .indices("index_a,index_b")
    .repository("my_repository")
    .snapshot("source_snapshot")
    .targetSnapshot("target_snapshot")
);
```

#### C#

```c#
var response = await client.Snapshot
    .CloneAsync(repository: "my_repository", snapshot: "source_snapshot", targetSnapshot: "target_snapshot", d1 => d1
        .Indices("index_a,index_b")
    );
```

#### PHP

```php
$resp = $client->snapshot()->clone([
    "repository" => "my_repository",
    "snapshot" => "source_snapshot",
    "target_snapshot" => "target_snapshot",
    "body" => [
        "indices" => "index_a,index_b",
    ],
]);
```

#### Ruby

```ruby
response = client.snapshot.clone(
  repository: "my_repository",
  snapshot: "source_snapshot",
  target_snapshot: "target_snapshot",
  body: {
    "indices": "index_a,index_b"
  }
)
```

