# Delete a snapshot

Unprotect a snapshot if needed, delete it, and confirm that it reports DELETED so it no longer blocks deleting its volume.

Delete a snapshot when you no longer need it, or to clear the way for deleting the volume it was taken from. A protected snapshot must be unprotected first.

## Before you begin [#before-you-begin]

<BeforeYouBegin>

- The snapshot’s URN.
- Permission `pvs.snapshot.delete` on the snapshot, and `pvs.snapshot.unprotect` if it’s protected. See [Roles](/docs/iam/roles).
- A snapshot that reports `COMPLETED` or `ERROR`. A `PENDING` snapshot can’t be deleted yet; wait until the copy finishes.

</BeforeYouBegin>

<Callout type="warning" title="Important">

The platform doesn’t check whether an image uses the snapshot. Once you unprotect or delete a snapshot, creating volumes from it and launching instances from an image built on it are refused.

</Callout>

## Unprotect the snapshot [#unprotect-the-snapshot]

Skip this section if the snapshot reports `protectionStatus: UNPROTECTED`.

1. Unprotect the snapshot. This works on a `COMPLETED` snapshot and on an `ERROR` snapshot, and also settles a snapshot whose `protectionStatus` is `FAILED`.

   ```sh
   origin storage unprotect-snapshot --snapshot-urn <snapshot-urn>
   ```

   With the API, use the `unprotectSnapshot` mutation:

   ```graphql
   mutation {
     pvs {
       unprotectSnapshot(input: { snapshotUrn: "<snapshot-urn>" }) {
         accepted
         message
       }
     }
   }
   ```

1. Check the snapshot until it reports `protectionStatus: UNPROTECTED`.

   ```sh
   origin storage get-snapshot --snapshot-urn <snapshot-urn>
   ```

## Delete the snapshot [#delete-the-snapshot]

1. Delete the snapshot.

   ```sh
   origin storage delete-snapshot --snapshot-urn <snapshot-urn>
   ```

   With the API, use the `deleteSnapshot` mutation:

   ```graphql
   mutation {
     pvs {
       deleteSnapshot(input: { snapshotUrn: "<snapshot-urn>" }) {
         accepted
         message
       }
     }
   }
   ```

   A delete request for a snapshot that isn’t `UNPROTECTED` is refused with the message `snapshot must be unprotected before it can be deleted`.

1. Check the snapshot until it reports `status: DELETED`.

   ```sh
   origin storage get-snapshot --snapshot-urn <snapshot-urn>
   ```

   A deleted snapshot drops out of `origin storage list-snapshots` at once. You can still look it up by URN, with no time limit.

## If this fails [#if-this-fails]

If the deletion is accepted but fails, the snapshot stays in your list as `ERROR` with a `statusReason`. Its copy may still exist, and it still blocks deleting its volume. Delete it again. If it’s still protected, unprotect it first.

## Next steps [#next-steps]

- [Delete a volume](/docs/storage/volumes/delete)

## Related [#related]

- [Snapshot states](/docs/storage/snapshots/snapshot-states)
- [`unprotect-snapshot` command](/docs/storage/reference/cli#unprotect-snapshot)
- [`delete-snapshot` command](/docs/storage/reference/cli#delete-snapshot)

