# Secrets

> Store API keys, tokens and passwords in the instance's vault, use them without ever printing them, and manage them from the dashboard.

Every instance has a **secrets vault** for API keys, tokens and passwords. Secrets stay out of the agent's
files, out of its memory and out of the chat.

## Giving a secret to your agent

- **From the agent's app**: add the secret in its secrets panel. You can leave the name empty and
  describe it: the agent gives it a name when it needs it.
- **When the agent asks**: when it needs a key, it asks you to put it in the vault instead of pasting
  it in the chat.

Never paste a secret in a conversation: conversations are stored and searchable.

## How the agent uses it

On the instance, the `molted secret` command manages the vault:

| Command | What it does |
|---|---|
| `molted secret set NAME` | Store a value (read from standard input), with a description and tags |
| `molted secret list` | List names, descriptions and tags, never values |
| `molted secret run -s NAME -- command …` | Run a command with the secret as an environment variable; the value is masked in the output |
| `molted secret rename ID NAME` | Name a secret added without a name |
| `molted secret delete NAME` | Delete it; it can be restored for 30 days |
| `molted secret restore NAME` | Bring a deleted secret back |

The agent never prints a value, never writes it to a file, a command line or a commit.

## What you see in the dashboard

The names, descriptions and tags of the secrets, never their values. You can add, replace and delete secrets.

## Secrets in templates

When you create instances from a [template](templates.md), bind secrets at creation (for example the client's
own API key) instead of writing them in the template's files.

## Secrets of the platform

Some secrets are created for you: the API key of the [management agent](management-agent.md), for example.
They live in the same vault and can be revoked from **Developers → API Keys**.
