# Chalk CLI Reference: Secrets
source: https://docs.chalk.ai/cli#secrets

Securely store and manage [secrets](https://docs.chalk.ai/docs/env-vars) used by your resolvers. Secrets are encrypted and injected at runtime.

## `chalk secret list`
source: https://docs.chalk.ai/cli?command=secret_list

```bash
chalk secret list [--decrypt]
```

Use the `chalk secret list` command to view the secrets that are available in this environment.

Secrets can be deleted with `chalk secret delete`.

**Flags**

- `--decrypt <decrypt>` (bool, default `false`)
  Decrypt the secrets.

**Example**

```
$ chalk secret list --decrypt
✓ Fetched secrets
 Name        Value             Integration  Updated
────────────────────────────────────────────────────
 PGDATABASE  abc               pgdemo       1mo ago
 PGHOST      44.444.444.444    pgdemo       1mo ago
 PGPASSWORD  abvdg$Qabw3-m!zP  pgdemo       1mo ago
 PGPORT      5432              pgdemo       2mo ago
 PGUSER      developer         pgdemo       1mo ago
 API_KEY     PRZ2fyw3ynf.cvm!               1mo ago
```

## `chalk secret get`
source: https://docs.chalk.ai/cli?command=secret_get

```bash
chalk secret get [--name] [--decrypt]
```

Use the 'chalk secret get' command to retrieve a specific secret by name.

You can either specify the secret name with the '--name' flag or select from a list.

**Flags**

- `--name <name>` (string)
  Name of the secret to get.
- `--decrypt <decrypt>` (bool, default `false`)
  Decrypt the secrets.

**Example**

```
$ chalk secret get --name my-secret --decrypt
✓ Fetched secret
Name: my-secret
Value: abc123
Updated: 1mo ago
```

## `chalk secret set`
source: https://docs.chalk.ai/cli?command=secret_set

```bash
chalk secret set [flags]
```

Use the `chalk secret set` command to upsert secrets. This command can be used to set one or more secrets at once.

**Interactive Mode (recommended)**

If no arguments are provided, `chalk secret set` will enter interactive mode, which will prompt you for the secret name and value. You can also provide only the secret name as an argument, and the CLI will prompt you for the value.

```
chalk secret set
```

**stdin (recommended)**

Using stdin is helpful for setting secrets whose value is the contents of a file:

```
cat key.pem | chalk secrets set TLS_CERT
```

You can also use stdin to set the value of a secret to the output of a command or script:

```
base64 -i chalk.p12 | chalk secrets set PKCS12_CERT
```

**Key-Value Pairs**

You can also provide key-value pairs as arguments to `chalk secret set`.

```
chalk secrets set HOSTNAME=73.62.143.151
chalk secrets set API_KEY=0x9Xz4#3 PORT=1234
```

Note that using key-value pairs will cause the secret value to be stored in your shell history. To avoid this, use interactive mode, stdin, or the web dashboard. Or, follow the instructions below to exclude `chalk secrets set` commands from being stored in your shell history.

**Exclude from Shell History**

Bash and ZSH will ignore `chalk secrets set` commands in your shell history if you set the `HISTIGNORE` or `HISTORY_IGNORE` environment variables, respectively.

For Bash, add the following to your `~/.bashrc` file:

```
export HISTIGNORE='*chalk secrets set*'
```

For ZSH, add the following to your `~/.zshrc` file:

```
HISTORY_IGNORE="(chalk secrets set*)"
```

**Example**

```
$ chalk secrets set HOSTNAME=73.62.143.151
✓ Secrets saved
```

## `chalk secret delete`
source: https://docs.chalk.ai/cli?command=secret_delete

```bash
chalk secret delete [--name]
```

Use the `chalk secret delete` command to delete a secret.

You can either specify the secret name with the `--name` flag, select a secret from a list, or specify the secret names as arguments.

**Flags**

- `--name <name>` (string[], default `[]`)
  Names of the secrets to delete.

**Example**

```
$ chalk secret delete --name my-secret
✓ Deleted secret
```
