Skip to main content

Manage vaults using 1Password SDKs

You can use 1Password SDKs to manage vaults in 1Password. You can only get information about vaults the authenticated user has access to, and you can only manage vaults where you have the Manage Vault permission.

We recommend authenticating with the 1Password desktop app to manage vaults. Service accounts are scoped to specific vaults, and must have explicit permission to create new vaults. Service accounts can't update existing vaults and can only delete vaults created by the service account.

TIP

See the examples folder in the 1Password Go, JavaScript, or Python SDK GitHub repository for full example code you can quickly clone and test in your project.

Create a vault

tip

If you're authenticating with a service account, make sure the service account has permission to create vaults. If it doesn't have permission to create vaults, you'll need to create a new service account with this permission or authenticate using the 1Password desktop app.

Use the Vaults().Create() method to create a new vault. This method requires a VaultCreateParams struct with the following fields:

  • Title: The name of the vault.
  • Description: An optional pointer to a string containing the vault's description.

Returns: A Vault struct.

Get a vault overview

Use the Vaults().GetOverview() method with the unique identifier (ID) of a vault to retrieve high-level metadata about the vault.

The following example gets the overview for the vault you created in the previous step.

Get vault details

Use the Vaults().Get() method with the unique identifier (ID) of a vault to get the vault's full metadata.

The following example gets details for the vault you retrieved in the previous step.

Update a vault

Use the Vaults().Update() method to modify the details of an existing vault. This method requires the following:

  • vaultID: The unique identifier of the vault you want to update.
  • A VaultUpdateParams struct that contains the new vault details:
    • Title: The new name for the vault.
    • Description: An updated description for the vault.

Returns: The updated Vault struct.

The following example updates the name and description of the vault you created in the first step.

Delete a vault

To delete a vault, use the Vaults().Delete() method with the unique identifier of the vault you want to delete.

The following example deletes the vault you created in the first step.

tip

You can also batch create, get, and delete items from a vault.

Learn more

Was this page helpful?