CLI: Multiple Accounts at the Same Time?

markdorison
markdorison
Community Member

Can the CLI be logged into multiple accounts at the same time? The only way I have been able to access items in two different accounts is to login to one at a time.


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided

Comments

  • TimBatist
    TimBatist
    Community Member

    Hello there, can you specify your use case? Aren't you able to switch accounts in between?

  • Hey @markdorison, thank you for reaching out to us.
    Do you mean retrieving items of different accounts with the same command, or without having to sign-in every time before retrieving items? I think both use-cases are achievable configuring an account filter, i.e. setting the --account flag or the $OP_ACCOUNT environment variables. Retrieving items of different accounts with the same command can be done with a command such as op item get item1 --account account1 && op item get item2 --account account2.
    Let me know if this page of our developer documentation helps: https://developer.1password.com/docs/cli/use-multiple-accounts/#use-multiple-accounts-at-the-same-time
    I am looking forward to hearing from you!

    Best,
    Horia

  • markdorison
    markdorison
    Community Member

    Hey @Horia.Culea_1P!
    I think these two items from the docs answer the question for my use case. Thank you!

    By default, all commands will be run from the account that signed in last (agilebits in the above example).

    To switch between accounts, use the --account flag to specify the shorthand of the signin address for the account you want to use.

  • No worries, don't hesitate to let us know if we can help with anything else!

This discussion has been closed.