> Markdown version of https://tuna.am/en/docs/cli/secrets/. Documentation index: [llms.txt](https://tuna.am/en/llms.txt), full text in one file: [llms-full.txt](https://tuna.am/en/llms-full.txt). Any page is available as Markdown: append `.md` to its URL without the trailing slash.

# tuna secrets

Secrets operations.

Alias: `secret`.

Guide with examples: [Secrets in the CLI](https://tuna.am/en/docs/secrets/cli.md).

| Flag                  | Description                                |
| --------------------- | ------------------------------------------ |
| `--api-key string`    | Your tuna.am api key (env `TUNA_API_KEY`). |
| `-o, --output string` | Output format (text, json or yaml).        |

## Subcommands

| Command                                      | Description                                       |
| -------------------------------------------- | ------------------------------------------------- |
| [`tuna secrets configs`](#configs)           | Manage secrets configs.                           |
| [`tuna secrets delete`](#delete)             | Delete one or more secrets.                       |
| [`tuna secrets download`](#download)         | Download a config's secrets.                      |
| [`tuna secrets environments`](#environments) | Manage secrets environments.                      |
| [`tuna secrets get`](#get)                   | Get the value of one or more secrets.             |
| [`tuna secrets list`](#list)                 | List secrets in a config.                         |
| [`tuna secrets open`](#open)                 | Open the secrets dashboard in a browser.          |
| [`tuna secrets projects`](#projects)         | Manage secrets projects.                          |
| [`tuna secrets run`](#run)                   | Run a command with injected secrets.              |
| [`tuna secrets set`](#set)                   | Set the value of one or more secrets.             |
| [`tuna secrets setup`](#setup)               | Bind a directory to a secrets project and config. |
| [`tuna secrets substitute`](#substitute)     | Substitute secrets into a template file.          |
| [`tuna secrets upload`](#upload)             | Upload secrets from a .env or .json file.         |

## tuna secrets configs

Manage secrets configs.

Alias: `config`.

Usage

```bash
tuna secrets configs [flags]

```

| Flag                   | Description                                                                   |
| ---------------------- | ----------------------------------------------------------------------------- |
| `-c, --config string`  | Configuration name (the CLI config file path is controlled by `TUNA_CONFIG`). |
| `--environment string` | Filter configs by environment slug.                                           |
| `-p, --project string` | Project name.                                                                 |
| `--scope string`       | Directory to scope configuration. Default: `.`.                               |

Also accepts the flags of `tuna secrets`.

| Command                                          | Description                            |
| ------------------------------------------------ | -------------------------------------- |
| [`tuna secrets configs clone`](#configs-clone)   | Clone a config within its environment. |
| [`tuna secrets configs create`](#configs-create) | Create a config in an environment.     |
| [`tuna secrets configs delete`](#configs-delete) | Delete a config.                       |
| [`tuna secrets configs get`](#configs-get)       | Get info for a config.                 |
| [`tuna secrets configs lock`](#configs-lock)     | Lock a config to prevent changes.      |
| [`tuna secrets configs logs`](#configs-logs)     | List config audit logs.                |
| [`tuna secrets configs rename`](#configs-rename) | Rename a config.                       |
| [`tuna secrets configs tokens`](#configs-tokens) | Manage a config's service tokens.      |
| [`tuna secrets configs unlock`](#configs-unlock) | Unlock a config.                       |

### tuna secrets configs clone

Clone a config within its environment.

Usage

```bash
tuna secrets configs clone [config] [flags]

```

| Flag                   | Description                                                                   |
| ---------------------- | ----------------------------------------------------------------------------- |
| `-c, --config string`  | Configuration name (the CLI config file path is controlled by `TUNA_CONFIG`). |
| `--name string`        | Name of the new config.                                                       |
| `-p, --project string` | Project name.                                                                 |
| `--scope string`       | Directory to scope configuration. Default: `.`.                               |

Also accepts the flags of `tuna secrets`.

### tuna secrets configs create

Create a config in an environment.

Usage

```bash
tuna secrets configs create [name] [flags]

```

| Flag                   | Description                                                                   |
| ---------------------- | ----------------------------------------------------------------------------- |
| `-c, --config string`  | Configuration name (the CLI config file path is controlled by `TUNA_CONFIG`). |
| `--environment string` | Environment slug.                                                             |
| `--locked`             | Create the config locked.                                                     |
| `-p, --project string` | Project name.                                                                 |
| `--scope string`       | Directory to scope configuration. Default: `.`.                               |

Also accepts the flags of `tuna secrets`.

### tuna secrets configs delete

Delete a config.

Alias: `rm`.

Usage

```bash
tuna secrets configs delete [config] [flags]

```

| Flag                   | Description                                                                   |
| ---------------------- | ----------------------------------------------------------------------------- |
| `-y, --yes`            | Skip the confirmation prompt.                                                 |
| `-c, --config string`  | Configuration name (the CLI config file path is controlled by `TUNA_CONFIG`). |
| `-p, --project string` | Project name.                                                                 |
| `--scope string`       | Directory to scope configuration. Default: `.`.                               |

Also accepts the flags of `tuna secrets`.

### tuna secrets configs get

Get info for a config.

Usage

```bash
tuna secrets configs get [config] [flags]

```

| Flag                   | Description                                                                   |
| ---------------------- | ----------------------------------------------------------------------------- |
| `-c, --config string`  | Configuration name (the CLI config file path is controlled by `TUNA_CONFIG`). |
| `-p, --project string` | Project name.                                                                 |
| `--scope string`       | Directory to scope configuration. Default: `.`.                               |

Also accepts the flags of `tuna secrets`.

### tuna secrets configs lock

Lock a config to prevent changes.

Usage

```bash
tuna secrets configs lock [config] [flags]

```

| Flag                   | Description                                                                   |
| ---------------------- | ----------------------------------------------------------------------------- |
| `-c, --config string`  | Configuration name (the CLI config file path is controlled by `TUNA_CONFIG`). |
| `-p, --project string` | Project name.                                                                 |
| `--scope string`       | Directory to scope configuration. Default: `.`.                               |

Also accepts the flags of `tuna secrets`.

### tuna secrets configs logs

List config audit logs.

Usage

```bash
tuna secrets configs logs [flags]

```

| Flag                   | Description                                                                   |
| ---------------------- | ----------------------------------------------------------------------------- |
| `-c, --config string`  | Configuration name (the CLI config file path is controlled by `TUNA_CONFIG`). |
| `--page int`           | Page number.                                                                  |
| `--page-size int`      | Page size.                                                                    |
| `-p, --project string` | Project name.                                                                 |
| `--scope string`       | Directory to scope configuration. Default: `.`.                               |

Also accepts the flags of `tuna secrets`.

### tuna secrets configs rename

Rename a config.

Usage

```bash
tuna secrets configs rename [config] [flags]

```

| Flag                   | Description                                                                   |
| ---------------------- | ----------------------------------------------------------------------------- |
| `-c, --config string`  | Configuration name (the CLI config file path is controlled by `TUNA_CONFIG`). |
| `--name string`        | New config name.                                                              |
| `-p, --project string` | Project name.                                                                 |
| `--scope string`       | Directory to scope configuration. Default: `.`.                               |

Also accepts the flags of `tuna secrets`.

### tuna secrets configs tokens

Manage a config's service tokens.

Alias: `token`.

Usage

```bash
tuna secrets configs tokens [flags]

```

| Flag                   | Description                                                                   |
| ---------------------- | ----------------------------------------------------------------------------- |
| `-c, --config string`  | Configuration name (the CLI config file path is controlled by `TUNA_CONFIG`). |
| `-p, --project string` | Project name.                                                                 |
| `--scope string`       | Directory to scope configuration. Default: `.`.                               |

Also accepts the flags of `tuna secrets`.

| Command                                                        | Description                          |
| -------------------------------------------------------------- | ------------------------------------ |
| [`tuna secrets configs tokens create`](#configs-tokens-create) | Create a service token for a config. |
| [`tuna secrets configs tokens revoke`](#configs-tokens-revoke) | Revoke a service token.              |

#### tuna secrets configs tokens create

Create a service token for a config.

Usage

```bash
tuna secrets configs tokens create [flags]

```

| Flag                   | Description                                                                   |
| ---------------------- | ----------------------------------------------------------------------------- |
| `--access string`      | Token access (read or write). Default: `read`.                                |
| `-c, --config string`  | Configuration name (the CLI config file path is controlled by `TUNA_CONFIG`). |
| `--description string` | Token description.                                                            |
| `--max-age string`     | Token lifetime as Go duration (e.g. 720h); empty means no expiration.         |
| `--plain`              | Print only the token without a trailing newline.                              |
| `-p, --project string` | Project name.                                                                 |
| `--scope string`       | Directory to scope configuration. Default: `.`.                               |

Also accepts the flags of `tuna secrets`.

#### tuna secrets configs tokens revoke

Revoke a service token.

Alias: `delete`, `rm`.

Usage

```bash
tuna secrets configs tokens revoke ID [flags]

```

| Flag        | Description                   |
| ----------- | ----------------------------- |
| `-y, --yes` | Skip the confirmation prompt. |

Also accepts the flags of `tuna secrets`.

### tuna secrets configs unlock

Unlock a config.

Usage

```bash
tuna secrets configs unlock [config] [flags]

```

| Flag                   | Description                                                                   |
| ---------------------- | ----------------------------------------------------------------------------- |
| `-c, --config string`  | Configuration name (the CLI config file path is controlled by `TUNA_CONFIG`). |
| `-p, --project string` | Project name.                                                                 |
| `--scope string`       | Directory to scope configuration. Default: `.`.                               |

Also accepts the flags of `tuna secrets`.

## tuna secrets delete

Delete one or more secrets.

Alias: `rm`.

Usage

```bash
tuna secrets delete KEY... [flags]

```

| Flag                   | Description                                                                   |
| ---------------------- | ----------------------------------------------------------------------------- |
| `-y, --yes`            | Skip the confirmation prompt.                                                 |
| `-c, --config string`  | Configuration name (the CLI config file path is controlled by `TUNA_CONFIG`). |
| `-p, --project string` | Project name.                                                                 |
| `--scope string`       | Directory to scope configuration. Default: `.`.                               |

Also accepts the flags of `tuna secrets`.

## tuna secrets download

Download a config's secrets.

Usage

```bash
tuna secrets download [filename] [flags]

```

| Flag                        | Description                                                                                          |
| --------------------------- | ---------------------------------------------------------------------------------------------------- |
| `-c, --config string`       | Configuration name.                                                                                  |
| `--format string`           | Output format (json, yaml, env, env-no-quotes or docker). Default: `json`.                           |
| `--name-transformer string` | Transform secret names (upper-camel, camel, lower-snake, lower-kebab, tf-var, dotnet or dotnet-env). |
| `--no-file`                 | Prints response to Stdout.                                                                           |
| `-p, --project string`      | Project name.                                                                                        |
| `--scope string`            | Directory to scope configuration. Default: `.`.                                                      |

Also accepts the flags of `tuna secrets`.

## tuna secrets environments

Manage secrets environments.

Alias: `envs`, `environment`.

Usage

```bash
tuna secrets environments [flags]

```

| Flag                   | Description                                                                   |
| ---------------------- | ----------------------------------------------------------------------------- |
| `-c, --config string`  | Configuration name (the CLI config file path is controlled by `TUNA_CONFIG`). |
| `-p, --project string` | Project name.                                                                 |
| `--scope string`       | Directory to scope configuration. Default: `.`.                               |

Also accepts the flags of `tuna secrets`.

| Command                                                    | Description                  |
| ---------------------------------------------------------- | ---------------------------- |
| [`tuna secrets environments create`](#environments-create) | Create an environment.       |
| [`tuna secrets environments delete`](#environments-delete) | Delete an environment.       |
| [`tuna secrets environments get`](#environments-get)       | Get info for an environment. |
| [`tuna secrets environments rename`](#environments-rename) | Rename an environment.       |

### tuna secrets environments create

Create an environment.

Usage

```bash
tuna secrets environments create NAME [flags]

```

| Flag                   | Description                                                                   |
| ---------------------- | ----------------------------------------------------------------------------- |
| `-c, --config string`  | Configuration name (the CLI config file path is controlled by `TUNA_CONFIG`). |
| `--personal-configs`   | Enable personal configs for the environment.                                  |
| `-p, --project string` | Project name.                                                                 |
| `--scope string`       | Directory to scope configuration. Default: `.`.                               |
| `--slug string`        | Environment slug (defaults to a slugified name).                              |

Also accepts the flags of `tuna secrets`.

### tuna secrets environments delete

Delete an environment.

Alias: `rm`.

Usage

```bash
tuna secrets environments delete ENVIRONMENT [flags]

```

| Flag                   | Description                                                                   |
| ---------------------- | ----------------------------------------------------------------------------- |
| `-y, --yes`            | Skip the confirmation prompt.                                                 |
| `-c, --config string`  | Configuration name (the CLI config file path is controlled by `TUNA_CONFIG`). |
| `-p, --project string` | Project name.                                                                 |
| `--scope string`       | Directory to scope configuration. Default: `.`.                               |

Also accepts the flags of `tuna secrets`.

### tuna secrets environments get

Get info for an environment.

Usage

```bash
tuna secrets environments get ENVIRONMENT [flags]

```

| Flag                   | Description                                                                   |
| ---------------------- | ----------------------------------------------------------------------------- |
| `-c, --config string`  | Configuration name (the CLI config file path is controlled by `TUNA_CONFIG`). |
| `-p, --project string` | Project name.                                                                 |
| `--scope string`       | Directory to scope configuration. Default: `.`.                               |

Also accepts the flags of `tuna secrets`.

### tuna secrets environments rename

Rename an environment.

Usage

```bash
tuna secrets environments rename ENVIRONMENT [flags]

```

| Flag                   | Description                                                                   |
| ---------------------- | ----------------------------------------------------------------------------- |
| `-c, --config string`  | Configuration name (the CLI config file path is controlled by `TUNA_CONFIG`). |
| `--name string`        | New environment name.                                                         |
| `-p, --project string` | Project name.                                                                 |
| `--scope string`       | Directory to scope configuration. Default: `.`.                               |
| `--slug string`        | New environment slug.                                                         |

Also accepts the flags of `tuna secrets`.

## tuna secrets get

Get the value of one or more secrets.

Usage

```bash
tuna secrets get KEY... [flags]

```

| Flag                   | Description                                                                                   |
| ---------------------- | --------------------------------------------------------------------------------------------- |
| `-c, --config string`  | Configuration name (the CLI config file path is controlled by `TUNA_CONFIG`).                 |
| `--plain`              | Print only raw values without a trailing newline (multiple values are separated by newlines). |
| `-p, --project string` | Project name.                                                                                 |
| `--scope string`       | Directory to scope configuration. Default: `.`.                                               |

Also accepts the flags of `tuna secrets`.

## tuna secrets list

List secrets in a config.

Alias: `ls`.

Usage

```bash
tuna secrets list [flags]

```

| Flag                   | Description                                                                   |
| ---------------------- | ----------------------------------------------------------------------------- |
| `-c, --config string`  | Configuration name (the CLI config file path is controlled by `TUNA_CONFIG`). |
| `--only-names`         | Only print the secret names.                                                  |
| `-p, --project string` | Project name.                                                                 |
| `--scope string`       | Directory to scope configuration. Default: `.`.                               |
| `--values`             | Show values instead of fingerprints in the VALUE column.                      |

Also accepts the flags of `tuna secrets`.

## tuna secrets open

Open the secrets dashboard in a browser.

Usage

```bash
tuna secrets open [flags]

```

| Flag                   | Description                                                                   |
| ---------------------- | ----------------------------------------------------------------------------- |
| `-c, --config string`  | Configuration name (the CLI config file path is controlled by `TUNA_CONFIG`). |
| `-p, --project string` | Project name.                                                                 |
| `--scope string`       | Directory to scope configuration. Default: `.`.                               |

Also accepts the flags of `tuna secrets`.

## tuna secrets projects

Manage secrets projects.

Alias: `project`.

Usage

```bash
tuna secrets projects

```

Also accepts the flags of `tuna secrets`.

| Command                                            | Description             |
| -------------------------------------------------- | ----------------------- |
| [`tuna secrets projects create`](#projects-create) | Create a project.       |
| [`tuna secrets projects delete`](#projects-delete) | Delete a project.       |
| [`tuna secrets projects get`](#projects-get)       | Get info for a project. |
| [`tuna secrets projects update`](#projects-update) | Update a project.       |

### tuna secrets projects create

Create a project.

Usage

```bash
tuna secrets projects create [name] [flags]

```

| Flag                   | Description                                  |
| ---------------------- | -------------------------------------------- |
| `--description string` | Project description.                         |
| `--slug string`        | Project slug (defaults to a slugified name). |

Also accepts the flags of `tuna secrets`.

### tuna secrets projects delete

Delete a project.

Alias: `rm`.

Usage

```bash
tuna secrets projects delete [project] [flags]

```

| Flag        | Description                   |
| ----------- | ----------------------------- |
| `-y, --yes` | Skip the confirmation prompt. |

Also accepts the flags of `tuna secrets`.

### tuna secrets projects get

Get info for a project.

Usage

```bash
tuna secrets projects get [project] [flags]

```

| Flag                   | Description                                                                   |
| ---------------------- | ----------------------------------------------------------------------------- |
| `-c, --config string`  | Configuration name (the CLI config file path is controlled by `TUNA_CONFIG`). |
| `-p, --project string` | Project name.                                                                 |
| `--scope string`       | Directory to scope configuration. Default: `.`.                               |

Also accepts the flags of `tuna secrets`.

### tuna secrets projects update

Update a project.

Usage

```bash
tuna secrets projects update [project] [flags]

```

| Flag                   | Description                                                                   |
| ---------------------- | ----------------------------------------------------------------------------- |
| `-c, --config string`  | Configuration name (the CLI config file path is controlled by `TUNA_CONFIG`). |
| `--description string` | New project description.                                                      |
| `--name string`        | New project name.                                                             |
| `-p, --project string` | Project name.                                                                 |
| `--scope string`       | Directory to scope configuration. Default: `.`.                               |
| `--slug string`        | New project slug.                                                             |

Also accepts the flags of `tuna secrets`.

## tuna secrets run

Run a command with injected secrets.

Usage

```bash
tuna secrets run -- [COMMAND] [ARGUMENTS] [flags]

```

| Flag                           | Description                                                                                                                                          |
| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--command string`             | Command to execute via shell (e.g. "echo $HOME && env").                                                                                             |
| `-c, --config string`          | Configuration name.                                                                                                                                  |
| `--fallback string`            | Path to the encrypted fallback file (default is derived from the configuration).                                                                     |
| `--fallback-only`              | Read secrets from the fallback file without contacting the API.                                                                                      |
| `--fallback-passphrase string` | Passphrase for the fallback file, env `TUNA_SECRETS_FALLBACK_PASSPHRASE` (default is derived from the API key, project and config).                  |
| `--fallback-readonly`          | Disable modifying the fallback file.                                                                                                                 |
| `--forward-signals`            | Forward signals to the child process (defaults to true when stdout is not a TTY). Default: `true`.                                                   |
| `--mount string`               | Write secrets to an ephemeral file (named pipe), accessible at `TUNA_SECRETS_MOUNT_PATH`; secrets are not injected into the environment.             |
| `--mount-format string`        | Mount file format (env, env-no-quotes, json, yaml or docker). Default: `env`.                                                                        |
| `--mount-max-reads int`        | Maximum number of times the mounted file can be read (0 for unlimited).                                                                              |
| `--mount-template string`      | Template file to render into the mount instead of a fixed format.                                                                                    |
| `--name-transformer string`    | Transform secret names (upper-camel, camel, lower-snake, lower-kebab, tf-var or dotnet-env).                                                         |
| `--no-fallback`                | Disable reading and writing the fallback file.                                                                                                       |
| `--offline`                    | Alias for `--fallback-only`.                                                                                                                         |
| `--only-secrets`               | Pass only secrets to the child process (plus PATH, HOME, PS1, USER, SHELL, TMPDIR).                                                                  |
| `--preserve-env string`        | List of secrets, comma-separated, for which the existing environment value takes precedence; "true" preserves all existing values. Default: `false`. |
| `-p, --project string`         | Project name.                                                                                                                                        |
| `--scope string`               | Directory to scope configuration. Default: `.`.                                                                                                      |
| `--watch`                      | Automatically restart the process when secrets change.                                                                                               |

Also accepts the flags of `tuna secrets`.

| Command                                | Description                |
| -------------------------------------- | -------------------------- |
| [`tuna secrets run clean`](#run-clean) | Delete old fallback files. |

### tuna secrets run clean

Delete old fallback files.

Usage

```bash
tuna secrets run clean [flags]

```

| Flag                 | Description                                                 |
| -------------------- | ----------------------------------------------------------- |
| `--all`              | Delete all fallback files regardless of age.                |
| `--dry-run`          | Only report what would be deleted.                          |
| `--max-age duration` | Delete fallback files older than this age. Default: `336h`. |

Also accepts the flags of `tuna secrets`. Also accepts the flags of `tuna secrets run`.

## tuna secrets set

Set the value of one or more secrets.

Value can be passed inline (`KEY=VALUE`), as a separate argument (KEY VALUE), piped via stdin (echo value | tuna secrets set KEY) or entered interactively.

Usage

```bash
tuna secrets set KEY=VALUE... [flags]

```

| Flag                   | Description                                                                                         |
| ---------------------- | --------------------------------------------------------------------------------------------------- |
| `-c, --config string`  | Configuration name (the CLI config file path is controlled by `TUNA_CONFIG`).                       |
| `--no-interactive`     | Do not allow entering the secret value interactively.                                               |
| `--note string`        | Note to set on the secrets.                                                                         |
| `-p, --project string` | Project name.                                                                                       |
| `--scope string`       | Directory to scope configuration. Default: `.`.                                                     |
| `--type string`        | Secret value type (string, json, boolean, integer, decimal, email, url, yaml, xml, date, datetime). |
| `--visibility string`  | Secret visibility (masked, unmasked or restricted).                                                 |

Also accepts the flags of `tuna secrets`.

## tuna secrets setup

Bind a directory to a secrets project and config.

The binding is looked up from `--scope` up to the git repository root: the secrets section of .tuna.yml is shared with everyone who clones the repository, a personal binding in the CLI config overrides it on this machine.

Usage

```bash
tuna secrets setup [flags]

```

Examples

```bash
tuna secrets setup
tuna secrets setup --local -p backend -c dev
tuna secrets setup -p backend -c dev_ivan
tuna secrets setup --unset

```

| Flag                   | Description                                                                  |
| ---------------------- | ---------------------------------------------------------------------------- |
| `-c, --config string`  | Configuration name.                                                          |
| `--local`              | Save the binding to the secrets section of .tuna.yml in the scope directory. |
| `--no-interactive`     | Fail instead of prompting when project or config is not specified.           |
| `-p, --project string` | Project name.                                                                |
| `--scope string`       | Directory to scope configuration. Default: `.`.                              |
| `--unset`              | Remove the personal binding of the scope directory.                          |

Also accepts the flags of `tuna secrets`.

## tuna secrets substitute

Substitute secrets into a template file.

Usage

```bash
tuna secrets substitute TEMPLATE [flags]

```

| Flag                   | Description                                                                   |
| ---------------------- | ----------------------------------------------------------------------------- |
| `-c, --config string`  | Configuration name (the CLI config file path is controlled by `TUNA_CONFIG`). |
| `--output string`      | Path to the output file (default is stdout).                                  |
| `-p, --project string` | Project name.                                                                 |
| `--scope string`       | Directory to scope configuration. Default: `.`.                               |

Also accepts the flags of `tuna secrets`.

## tuna secrets upload

Upload secrets from a .env or .json file.

Usage

```bash
tuna secrets upload FILE [flags]

```

| Flag                   | Description                                                                   |
| ---------------------- | ----------------------------------------------------------------------------- |
| `-c, --config string`  | Configuration name (the CLI config file path is controlled by `TUNA_CONFIG`). |
| `-p, --project string` | Project name.                                                                 |
| `--scope string`       | Directory to scope configuration. Default: `.`.                               |

Also accepts the flags of `tuna secrets`.

[Global flags](https://tuna.am/en/docs/cli.md#global-flags) work too.
