---
url: https://docs.mochiexec.io/reference/cli/mochi_secret_set.md
description: >-
  Set a secret in the current vault. If no value is provided, you will be
  prompted to enter one.
---

# mochi secret set

Set a secret in the current vault. If no value is provided, you will be prompted to enter one.

```shell
mochi secret set NAME [VALUE] [flags]
```

## Examples

```shell
mochi secret set MY_TOKEN              # prompted securely
mochi secret set MY_TOKEN s3cr3t       # inline value
mochi secret set MY_TOKEN --from-file ./token.txt
```

## Options

| Flag | Type | Description |
|------|------|-------------|
| `--file` | `string` | File to read the secret's value from |
| `-h, --help` |  | help for set |
| `-o, --output` | `string` | Output format. One of: yaml, json, or tui. |
| `-V, --vault` | `string` | Vault name to use instead of the current vault. |

## Options inherited from parent commands

| Flag | Type | Description |
|------|------|-------------|
| `-L, --log-level` | `string` | Log verbosity level (debug, info, fatal) (default "info") |
| `--sync` |  | Sync flow cache and workspaces |

## See also

* [mochi secret](mochi_secret.md) — Manage secrets stored in a vault.
