---
title: "Secrets"
description: "Where HolaClaw Server keeps API keys, bot tokens and sign-in tokens, and how to store them safely with holaclaw auth set."
updated: 2026-11-16
canonical: https://holaclaw.ai/docs/server/secrets
---

HolaClaw Server keeps every secret in one file, `auth.toml`, in the secrets directory. Secrets never go in `config.toml`, `channels.toml`, `connectors.toml` or an agent's files.

Only `holaclaw auth set`, `holaclaw login`, `holaclaw connectors` and the API write `auth.toml`. You should not need to edit it by hand.

## Where it is

| Deployment | Secrets directory |
| --- | --- |
| Container | `/etc/holaclaw-secrets`, in the `holaclaw-secrets` volume |
| System service | `/etc/holaclaw/secrets` |
| Your own user | `~/.config/holaclaw/secrets` |
| NixOS | `/etc/holaclaw/secrets`, which the module's `secretsDir` must name |

`server.secrets_dir` in `config.toml` sets it. `auth.toml` must have mode `0600`: `holaclaw check` fails with `SEC001` when others can read it.

## Store a secret

`holaclaw auth set <owner> <field>` reads the value from stdin, so it never lands in your shell history:

```sh
read -rs KEY && printf %s "$KEY" | holaclaw auth set providers.openrouter api_key; unset KEY
```

| What | Command |
| --- | --- |
| A provider's API key | `holaclaw auth set providers.<name> api_key` |
| A Telegram bot token | `holaclaw auth set channels.<name> bot_token` |
| Slack tokens | `holaclaw auth set channels.<name> bot_token`, and `app_token` |
| A Google Chat service account | `holaclaw auth set channels.<name> service_account < key.json` |
| A ChatGPT subscription | `holaclaw login codex` |
| A WhatsApp account | `holaclaw login whatsapp` |

In the container, use `docker exec -i holaclaw holaclaw auth set …` (with `-i`, without `-t`) so stdin reaches it.

A provider's key is sent only when the provider has `auth = "api-key"`. Without it, `check` warns `SEC007`.

## Keys from the environment

A provider's `api_key` in `config.toml` may be an environment variable reference instead, when your secret manager injects it into the daemon's environment:

```toml
[providers.openrouter]
type     = "openai-compatible"
base_url = "https://openrouter.ai/api/v1"
auth     = "api-key"
api_key  = "env:OPENROUTER_API_KEY"
```

A literal key in `config.toml` is an error (`CFG009`).

## The owner's token

`init --token-file <path>` writes an admin token for the owner, mode `0600`. You need it only for scripts and clients that reach the daemon's Control API over TCP. The `holaclaw` command on the same machine uses the control socket instead, where file permissions decide who may use it.

## Backups and secrets

A backup includes `auth.toml` only with `--include-secrets`. Whoever has such an archive holds every credential, so keep it like a key. See [Backups and restore](/docs/server/backups).

