Skip to main content

Use service accounts with 1Password CLI

You can use 1Password Service Accounts with 1Password CLI to manage vaults and items. See supported commands.

Requirements

Before you use service accounts with 1Password CLI, you need to:

Get started

To use a service account with 1Password CLI:

  1. Set the OP_SERVICE_ACCOUNT_TOKEN environment variable to the service account token:

  2. Run the following command to make sure the service account is configured:

    See result...
caution

If you have 1Password CLI configured to work with 1Password Connect, the OP_CONNECT_HOST and OP_CONNECT_TOKEN environment variables take precedence over OP_SERVICE_ACCOUNT_TOKEN.

Clear the Connect environment variables to configure a service account instead.

Supported commands

You can now run supported 1Password CLI commands authenticated as the service account:

To use the following commands, you must specify a vault with the --vault flag if the service account has access to more than one vault:

The following commands are only supported for vaults created by the service account:

Unsupported commands

When using a service account, the following commands aren't supported:

Although service accounts support some user, group, and vault management commands, we recommend against using them because a full provisioning workflow isn't supported:

Commands that make multiple requests

Service accounts have hourly and daily limits on the total number of requests the service account can make.

You can sometimes reduce the number of requests made by passing a vault or item's unique identifier (ID) instead of its name.

1Password CLI commands make one request unless otherwise noted. The following commands make more than one request:

CommandTotal requestsNotes
op item list1 + 1 per vault the service account has access toTo limit total requests to 3, list items in a specific vault using the --vault flag. Pass the vault's ID to further limit requests to 2.
op item get3 readsTo reduce to 1 request, pass the item and vault IDs.
op item create1 read and 1 writeTo reduce to 1 request, pass the vault ID.
op item delete5 reads and 1 writeTo reduce the read requests by 1, pass the vault ID.
op item edit5 reads and 1 writeTo reduce the read requests by 1, pass the vault ID.
op read3 readsTo reduce to 1 request, pass the item and vault IDs.
op vault delete2 reads + 1 writeTo reduce the read requests by 1, pass the vault ID.
op vault editup to 3 writesThe number of requests may vary depending on how many changes are made with a single command.
op vault get2 readsTo reduce the read requests by 1, pass the vault ID.

Was this page helpful?