Bitwarden Vault CLI
Set up and use Bitwarden CLI (bw). Use when installing the CLI, authenticating (login/unlock), or reading secrets from your vault. Supports email/password, API key, and SSO authentication methods.
Set up and use Bitwarden CLI (bw). Use when installing the CLI, authenticating (login/unlock), or reading secrets from your vault. Supports email/password, API key, and SSO authentication methods.
Real data. Real impact.
Emerging
Developers
Per week
Open source
Skills give you superpowers. Install in 30 seconds.
The Bitwarden command-line interface (CLI) provides full access to your Bitwarden vault for retrieving passwords, secure notes, and other secrets programmatically.
CRITICAL: Always run
bw commands inside a dedicated tmux session. The CLI requires a session key (BW_SESSION) for all vault operations after authentication. A tmux session preserves this environment variable across commands.
bw --version to confirm the CLI is availabletmux new-session -d -s bw-sessionbw login or bw unlock inside the sessionBW_SESSION as instructed by the CLIbw get, bw list, etc. within the same session| Method | Command | Use Case |
|---|---|---|
| Email/Password | | Interactive sessions, first-time setup |
| API Key | | Automation, scripts (requires separate unlock) |
| SSO | | Enterprise/organization accounts |
After
bw login with email/password, your vault is automatically unlocked. For API key or SSO login, you must subsequently run bw unlock to decrypt the vault.
The unlock command outputs a session key. You must export it:
# Bash/Zsh export BW_SESSION="<session_key_from_unlock>"Or capture automatically
export BW_SESSION=$(bw unlock --raw)
Session keys remain valid until you run
bw lock or bw logout. They do not persist across terminal windows—hence the tmux requirement.
# Get password by item name bw get password "GitHub"Get username
bw get username "GitHub"
Get TOTP code
bw get totp "GitHub"
Get full item as JSON
bw get item "GitHub"
Get specific field
bw get item "GitHub" | jq -r '.fields[] | select(.name=="api_key") | .value'
List all items
bw list items
Search items
bw list items --search "github"
bw lock when finished with vault operationsbw unlockbw login first| Variable | Purpose |
|---|---|
| Session key for vault decryption (required for all vault commands) |
| API key client ID (for login) |
| API key client secret (for login) |
| Custom config directory (enables multi-account setups) |
For Vaultwarden or self-hosted Bitwarden:
bw config server https://your-bitwarden-server.com
No automatic installation available. Please visit the source repository for installation instructions.
View Installation Instructions1,500+ AI skills, agents & workflows. Install in 30 seconds. Part of the Torly.ai family.
© 2026 Torly.ai. All rights reserved.