> ## 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 get MysteryBox secrets and versions

You can get information about secrets, their versions and payloads:

* If you want to get general information about secrets (for example, a secret ID), [get a list of secrets](#how-to-get-a-list-of-secrets).
* If you want to find out what versions a secret has, [get a list of its versions](#how-to-get-a-list-of-versions).
* If you want to get sensitive information stored in a secret's version, [get the version payload](#how-to-get-a-payload).

For more information, see [Overview of the MysteryBox service](../overview).

## How to get a list of secrets

Run the following command:

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

To include secrets that have been deleted in the last 30 days and can still be [restored](./delete#how-to-restore-a-secret), add `--show-scheduled-for-deletion`:

```bash theme={null}
nebius mysterybox secret list --show-scheduled-for-deletion
```

## How to get a list of versions

To get versions of a given secret, run the following command:

```bash theme={null}
nebius mysterybox secret-version list --parent-id mbsec-*** --show-scheduled-for-deletion
```

The command contains the following parameters:

* `--parent-id`: ID of the secret. To get the ID, run `nebius mysterybox secret list`.
* `--show-scheduled-for-deletion` (optional): In addition to existing versions, lists versions that have been deleted in the last 30 days and can still be [restored](./delete#how-to-restore-a-version).

## How to get a payload

Before you begin, make sure you are in a group that has at least the `mysterybox.payload-viewer` role. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console.

<Warning>
  Creating a secret or a version of a secret does not automatically grant you access to view payloads in that secret or version. The `editor` role is enough to create a secret or a version, but viewing payloads requires the `mysterybox.payload-viewer` role, which is a sub-role of `admin` but not `editor`.
</Warning>

To get the payload of a given version, run the following command:

```bash theme={null}
nebius mysterybox payload get --secret-id mbsec-*** --version-id mbsecver-***
```

In the command, set the following parameters:

* `--secret-id`: ID of the secret. To get the ID, run <code>nebius mysterybox secret list</code>.
* `--version-id` (optional): ID of the version. To get the ID, run <code>nebius mysterybox secret-version list --parent-id \<secret\_ID></code>.

  If you do not specify `--version-id`, the command returns the payload of the primary version.
