Use multiple accounts
With the 1Password app integration turned on, you can use 1Password CLI with all the accounts you've added to the 1Password app.
If you use multiple 1Password accounts, you can switch between them by signing in and out with op signin
, using the --account
flag with each command, or by setting the OP_ACCOUNT
environment variable.
Switch accounts with op signin
By default, all 1Password CLI commands are executed with the account you most recently signed in to, unless an account is specified with the --account
flag.
To sign in to a different account, run op signin
and select the account you want to sign in to from the list of accounts added to your 1Password app.
Specify an account with the --account
flag
You can execute a command with a specific account by including the --account
flag along with the account's sign-in address (with or without https://) or ID.
For example, to get a list of all vaults in an account with the sign-in address my.1password.com
:
You can use the --account
flag to specify different accounts in scripts. For example:
Set the OP_ACCOUNT
environment variable
If you only want to sign in to a specific account, you can set the OP_ACCOUNT
environment variable to the account's sign-in address or ID. You can also use this to specify an account in scripts.
- Bash, Zsh, sh
- fish
- PowerShell
Find an account sign-in address or ID
To find details about all the accounts you've added to the 1Password app, run op account list
.
See result...
You can use the sign-in address or user ID to refer to a specific account in your commands.