Opening a specific 1Password item from the terminal in the 1Password desktop app
How to Open a Specific 1Password Item in the Desktop App from the CLI
There is a need to bring up a frequently used 1Password item in the desktop app with one command from the CLI.
The onepassword:// URL scheme exists, but the official documentation says almost nothing about the format for opening a specific item. After trying various things, I found that rewriting the private link URL just a little opens the item directly in the desktop app without going through the browser.
Steps
1. Copy the Private Link in 1Password
In the 1Password desktop app, right-click the item you want to open and select "Copy Private Link".
A URL in this format is copied to the clipboard.
https://start.1password.com/open/i?a=ABCDEFGHIJKLMNOPQRSTUVWXYZ&v=ZYXWVUTSRQPONMLKJIHGFEDCBA&i=noagqauoq2qmya7tdiavvvslf4&h=my.1password.com
The parameters mean the following.
a= account UUIDv= vault UUIDi= item UUIDh= hostname
2. Rewrite the beginning of the URL
Replace the https://start.1password.com part of the copied URL with onepassword:.
Before
https://start.1password.com/open/i?a=...&v=...&i=...&h=...
After
onepassword://open/i?a=...&v=...&i=...&h=...
3. Open it with the open command
open 'onepassword://open/i?a=ABCDEFGHIJKLMNOPQRSTUVWXYZ&v=ZYXWVUTSRQPONMLKJIHGFEDCBA&i=noagqauoq2qmya7tdiavvvslf4&h=my.1password.com'
Wrap the URL in single quotes. This keeps the shell from treating & as background execution.
This launches the 1Password desktop app and shows the item directly. The browser does not open. You can also combine it with scripts for launchers (Alfred, Raycast, etc.).
URL Schemes That Don’t Work
There is also wrong information here and there on the net, and the following format does not work.
# Example that doesn't work
open 'onepassword://view-item?i=noagqauoq2qmya7tdiavvvslf4'
There is no view-item path. The onepassword: protocol itself is valid, so 1Password may start, but the specific item is not shown.
The correct format is onepassword://open/i?a=...&v=...&i=...&h=..., and all four parameters are required.
Why This Works
As a 1Password developer has mentioned on the forum, the share link https://start.1password.com/open/i?... is a format that the 1Password app is registered for as a URL handler in the first place. If the desktop app is installed, the app starts and shows the item when this HTTPS link is opened.
However, it goes through the browser once, so depending on settings the browser comes up first. To avoid that, you only need to rewrite it to the onepassword:// scheme from the start.
Notes
- This usage is not stated in the official documentation, so the behavior may change in a future 1Password version (the share link feature itself is stable, though).
- On macOS, this assumes the 1Password 8 desktop app is installed.
- Behavior may differ on iOS. This article assumes behavior on macOS.
Related posts
We look forward to discussing your development needs.