---
type: api
title: Remove the attached snapshot repository
description: Removes the attached snapshot repository. This is only possible if the repository is not in use anymore by any searchable snapshots.
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/cloud-enterprise/v4/operation/operation-delete-deployment-es-resource-snapshot-repository
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/cloud-enterprise/v4/operation/operation-delete-deployment-es-resource-snapshot-repository
products:
  - Elastic Cloud Enterprise
---

# Remove the attached snapshot repository

## Paths

- `DELETE` `/deployments/{deployment_id}/elasticsearch/{ref_id}/snapshot/repository/{repository_name}`

- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/cloud-enterprise/v4/authentication#basicauth)
- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/cloud-enterprise/v4/authentication#apikey)

#### Path Parameters

- `deployment_id` (string)
  Identifier for the Deployment
- `ref_id` (string)
  User-specified RefId for the Resource (or '_main' if there is only one)
- `repository_name` (string)
  The name of the snapshot repository to remove (e.g. _clone_abcd1234)

## Description

Removes the attached snapshot repository. This is only possible if the repository is not in use anymore by any searchable snapshots.

## Responses

#### `200`

`application/json`

Type: `EmptyResponse`

#### `404`

* The Deployment specified by {deployment_id} cannot be found. (code: `deployments.deployment_not_found`)
* The Resource specified by {ref_id} cannot be found. (code: `deployments.deployment_resource_not_found`)
* The snapshot repository specified by {repository_name} cannot be found. (code: `deployments.snapshot_dependency_not_found`)

`application/json`

- `errors` ([] BasicFailedReplyElement)
  A list of errors that occurred in the failing request
  - `code` (string)
    A structured code representing the error type that occurred
  - `message` (string)
    A human readable message describing the error that occurred
  - `fields` ([] string)
    If the error can be tied to a specific field or fields in the user request, this lists those fields
##### Response Headers

- `x-cloud-error-codes` (enum)
  The error codes associated with the response

#### `500`

We have failed you. (code: `deployments.metadata_internal_error`)

`application/json`

- `errors` ([] BasicFailedReplyElement)
  A list of errors that occurred in the failing request
  - `code` (string)
    A structured code representing the error type that occurred
  - `message` (string)
    A human readable message describing the error that occurred
  - `fields` ([] string)
    If the error can be tied to a specific field or fields in the user request, this lists those fields
##### Response Headers

- `x-cloud-error-codes` (enum)
  The error codes associated with the response

## Code Examples

#### Console

```console
DELETE /deployments/{deployment_id}/elasticsearch/{ref_id}/snapshot/repository/{repository_name}
```

#### curl

```curl
curl -X DELETE "/deployments/{deployment_id}/elasticsearch/{ref_id}/snapshot/repository/{repository_name}"
```

