Skip to content

bhatti secret set

Create or update a secret.

bhatti secret set <name> <value>

Encrypts the value with the server’s age key and stores it under the given name, scoped to the authenticated user. Re-running with the same name overwrites the previous value with no error.

The CLI takes the value as a positional argument. There’s no stdin variant — long or multiline values pass through your shell history. For sensitive values, use a shell that doesn’t record (HISTCONTROL=ignorespace + leading space) or pipe through a temp variable that you unset afterwards.

Terminal window
bhatti secret set OPENAI_KEY sk-abc123def456
ok
Terminal window
# Update is the same call
bhatti secret set OPENAI_KEY sk-new-value
Terminal window
# Multiline / connection string
bhatti secret set DATABASE_URL "postgres://user:pass@db.internal:5432/app?sslmode=require"
Terminal window
# Avoid shell history (bash with HISTCONTROL=ignorespace, note leading space)
bhatti secret set OPENAI_KEY sk-abc123def456

This command takes only global flags. See Global flags for --url, --token, --json, --timing, --data-dir.