> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nebius.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to delete secrets and their versions in SecretStash

<Note>
  MysteryBox is now called SecretStash. The Nebius AI Cloud CLI, API and Terraform provider still use the `mysterybox` service identifier. Keep using `mysterybox` in scripts and manifests.
</Note>

You can delete individual versions or entire secrets. Deleted items can be restored within 30 days. After 30 days, deleted secrets and versions are permanently removed.

## Prerequisites

Make sure you are in a [group](/iam/authorization/groups/index) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console.

## Deleting versions and secrets

### How to delete a version

You can delete any version, even a primary one. However, if you delete a primary version and do not [assign another version as primary](/mysterybox/secrets/make-version-primary), you will receive an error when requesting the secret payload without specifying a version. You can only retrieve a payload without specifying a version if the secret has a primary version.

<Tabs>
  <Tab title="Web console">
    1. In the [web console](https://console.nebius.com), go to <Icon icon="https://mintcdn.com/nebius-ai-cloud/BhI64Dlym_yJl7Yy/_assets/sidebar/cryptography.svg?fit=max&auto=format&n=BhI64Dlym_yJl7Yy&q=85&s=e2af8c31917650f2951761ab265dd9b9" width="14" height="16" data-path="_assets/sidebar/cryptography.svg" /> **Cryptography** → **SecretStash**.
    2. Open the page of the required secret.
    3. Go to the **Versions** tab.
    4. In the line of the version that you want to delete, click <Icon icon="https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/button-vellipsis.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=e80b8e57c43bfd117679262e6a1334ad" width="12" height="24" data-path="_assets/button-vellipsis.svg" /> → **Delete**.
    5. Confirm the version deletion.
  </Tab>

  <Tab title="CLI">
    1. List all secrets:

       ```bash theme={null}
       nebius mysterybox secret list
       ```

       In the output, copy the ID of the secret whose version you want to delete.

    2. List all versions of the secret:

       ```bash theme={null}
       nebius mysterybox secret-version list --parent-id <secret_ID>
       ```

       In the command, specify the copied ID.

       In the output, find the version that you want to delete and copy its ID.

    3. Delete the version:

       ```bash theme={null}
       nebius mysterybox secret-version delete <version_ID>
       ```

       To make sure that the version is deleted, check its status in the output. It should be empty (`status: {}`).
  </Tab>
</Tabs>

### How to delete a secret

<Tabs>
  <Tab title="Web console">
    1. In the [web console](https://console.nebius.com), go to <Icon icon="https://mintcdn.com/nebius-ai-cloud/BhI64Dlym_yJl7Yy/_assets/sidebar/cryptography.svg?fit=max&auto=format&n=BhI64Dlym_yJl7Yy&q=85&s=e2af8c31917650f2951761ab265dd9b9" width="14" height="16" data-path="_assets/sidebar/cryptography.svg" /> **Cryptography** → **SecretStash**.
    2. Locate the required secret and then click <Icon icon="https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/button-vellipsis.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=e80b8e57c43bfd117679262e6a1334ad" width="12" height="24" data-path="_assets/button-vellipsis.svg" /> → **Delete**.
    3. Confirm the deletion of the secret.
  </Tab>

  <Tab title="CLI">
    1. List all secrets:

       ```bash theme={null}
       nebius mysterybox secret list
       ```

       In the output, copy the ID of the secret that you want to delete.

    2. Delete the secret:

       ```bash theme={null}
       nebius mysterybox secret delete <secret_ID>
       ```

       To make sure that the secret is deleted, check its status in the output. It should be empty (`status: {}`).
  </Tab>
</Tabs>

<Note>
  A deleted secret counts toward the [quota on the number of secrets](/mysterybox/resources/quotas-limits) for 30 days after you delete it. If you hit the quota, you can [request to increase it](/overview/quotas#change-quotas).
</Note>

## Restoring versions and secrets

You can restore deleted items within 30 days after deletion.

### How to restore a version

<Tabs>
  <Tab title="Web console">
    1. In the [web console](https://console.nebius.com), go to <Icon icon="https://mintcdn.com/nebius-ai-cloud/BhI64Dlym_yJl7Yy/_assets/sidebar/cryptography.svg?fit=max&auto=format&n=BhI64Dlym_yJl7Yy&q=85&s=e2af8c31917650f2951761ab265dd9b9" width="14" height="16" data-path="_assets/sidebar/cryptography.svg" /> **Cryptography** → **SecretStash**.
    2. Open the page of the required secret.
    3. Go to the **Versions** tab.
    4. To view versions scheduled for deletion, switch to the **Inactive** tab.
    5. In the line of the required version, click **Restore**.
    6. Confirm the version restoration.
  </Tab>

  <Tab title="CLI">
    Run the following command:

    ```bash theme={null}
    nebius mysterybox secret-version undelete --id <version_ID>
    ```

    To make sure that the version is restored, check its status in the output. It should be `ACTIVE`.
  </Tab>
</Tabs>

### How to restore a secret

<Tabs>
  <Tab title="Web console">
    1. In the [web console](https://console.nebius.com), go to <Icon icon="https://mintcdn.com/nebius-ai-cloud/BhI64Dlym_yJl7Yy/_assets/sidebar/cryptography.svg?fit=max&auto=format&n=BhI64Dlym_yJl7Yy&q=85&s=e2af8c31917650f2951761ab265dd9b9" width="14" height="16" data-path="_assets/sidebar/cryptography.svg" /> **Cryptography** → **SecretStash**.
    2. To view secrets scheduled for deletion, switch to the **Inactive** tab.
    3. Locate the required secret and then click **Restore**.
    4. Confirm the restoration of the secret.
  </Tab>

  <Tab title="CLI">
    Run the following command:

    ```bash theme={null}
    nebius mysterybox secret undelete --id <secret_ID>
    ```

    To make sure that the secret is restored, check its status in the output. It should be `ACTIVE`.
  </Tab>
</Tabs>
