> ## Documentation Index
> Fetch the complete documentation index at: https://www.1password.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Manage vaults using 1Password SDKs

You can use 1Password SDKs to manage [vaults](https://support.1password.com/1password-glossary#vault) 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](/sdks/vault-permissions#appendix-vault-permissions).

We recommend authenticating with the [1Password desktop app](/sdks/concepts#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.

## Before you get started

Before you begin, [follow the steps to get started](/sdks#get-started) with a 1Password SDK. The examples on this page assume you have an initialized `client` instance. For example:

<Tabs groupId="sdks">
  <Tab value="go" title="Go">
    {/* markdownlint-disable MD046 */}

    ```go theme={null}
    package main

    import (
    	"context"

    	"github.com/1password/onepassword-sdk-go"
    )

    func main() {
    	// TODO: Initialize client using your preferred authentication method (see Overview > Get started)
    	client, err := onepassword.NewClient(context.Background(),
    	)
    	if err != nil {
    		panic(err)
    	}

    	// Your code here
    }

    ```
  </Tab>

  <Tab value="js" title="JavaScript">
    {/* markdownlint-disable MD046 */}

    <Tabs groupId="sdk-before-start-js">
      <Tab value="esm" title="ES Modules">
        ```javascript theme={null}
        import sdk from "@1password/sdk";

        async function main() {
          const client = await sdk.createClient({
            // TODO: Initialize client using your preferred authentication method (see Overview > Get started)
          });

          // Your code here
        }

        main().catch(console.error);

        ```
      </Tab>

      <Tab value="cjs" title="CommonJS">
        ```javascript theme={null}
        const sdk = require("@1password/sdk");

        async function main() {
          const client = await sdk.createClient({
            // TODO: Initialize client using your preferred authentication method (see Overview > Get started)
          });

          // Your code here
        }

        main().catch(console.error);

        ```
      </Tab>
    </Tabs>
  </Tab>

  <Tab value="python" title="Python">
    {/* markdownlint-disable MD046 */}

    ```python theme={null}
    import asyncio

    from onepassword import Client  # Also import DesktopAuth for desktop app authentication.

    async def main():
        # TODO: Initialize client using your preferred authentication method (see Overview > Get started)
        client = await Client.authenticate(...)

        # Your code here

    asyncio.run(main())

    ```
  </Tab>
</Tabs>

<Tip>
  See the examples folder in the 1Password [Go](https://github.com/1Password/onepassword-sdk-go/tree/main/example), [JavaScript](https://github.com/1Password/onepassword-sdk-js/tree/main/examples), or [Python](https://github.com/1Password/onepassword-sdk-python/tree/main/example) SDK GitHub repository for full example code you can quickly clone and test in your project.
</Tip>

## 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](/service-accounts/get-started#create-a-service-account) with this permission or authenticate using [the 1Password desktop app](/sdks/concepts#1password-desktop-app).
</Tip>

<Tabs groupId="sdks">
  <Tab value="go" title="Go">
    Use the [`Vaults().Create()`](https://github.com/1Password/onepassword-sdk-go/blob/main/vaults.go#L50) method to create a new vault. This method requires a [`VaultCreateParams`](https://github.com/1Password/onepassword-sdk-go/blob/main/types.go#L1040) 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`](https://github.com/1Password/onepassword-sdk-go/blob/main/types.go#L1021) struct.

    ```go theme={null}
    description := "This vault was created with the Go SDK."
    // Create a vault with a description
    createParams := onepassword.VaultCreateParams{
    	Title:       "Go SDK Vault",
    	Description: &description,
    }

    createdVault, err := client.Vaults().Create(context.Background(), createParams)
    if err != nil {
    	panic(err)
    }
    fmt.Printf("Created vault with description: %v\\n", createdVault)
    ```
  </Tab>

  <Tab value="js" title="JavaScript">
    Use the [`vaults.create()`](https://github.com/1Password/onepassword-sdk-js/blob/main/client/src/vaults.ts#L79) method to create a new vault. This method requires an options object with the following properties:

    * `title`: The name of the vault.
    * `description`: An optional description for the vault.

    Returns: A Promise that resolves to a [`Vault`](https://github.com/1Password/onepassword-sdk-js/blob/main/client/src/types.ts#L568) object.

    ```js theme={null}
    // Create a vault
    createdVault = await client.vaults.create({
      title: "JS SDK Vault",
      description: "A vault created via the JS SDK",
    });
    console.log(
      "Created vault",
      createdVault.title,
      "(" + createdVault.id + ")",
    );
    ```
  </Tab>

  <Tab value="python" title="Python">
    Use the [`vaults.create()`](https://github.com/1Password/onepassword-sdk-python/blob/main/src/onepassword/vaults.py#L28) method to create a new vault. This method requires a [`VaultCreateParams`](https://github.com/1Password/onepassword-sdk-python/blob/main/src/onepassword/types.py#L1310) object with the following parameters:

    * `title`: The name of the vault.
    * `description`: An optional description for the vault.
    * `allow_admins_access`: A boolean that determines whether people who belong to the [Administrators](https://support.1password.com/1password-glossary/#administrator) group can access the vault.

    Returns: A [`Vault`](https://github.com/1Password/onepassword-sdk-python/blob/main/src/onepassword/types.py#L1269) object.

    ```python theme={null}
    from onepassword import VaultCreateParams

    # Create a vault
    vault_create_params = VaultCreateParams(
    title="Python SDK Vault",
    description="A description",
    allow_admins_access=False,
    )
    created_vault = await client.vaults.create(vault_create_params)
    print(f"Created vault: {created_vault.id} - {created_vault.title}")
    ```
  </Tab>
</Tabs>

## Get a vault overview

<Tabs groupId="sdks">
  <Tab value="go" title="Go">
    Use the [`Vaults().GetOverview()`](https://github.com/1Password/onepassword-sdk-go/blob/main/vaults.go#L86) method with the [unique identifier (ID)](/sdks/concepts#unique-identifiers) 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](#create-a-vault).

    ```go theme={null}
    // Get vault overview
    vaultOverview, err := client.Vaults().GetOverview(context.Background(), createdVault.ID)
    if err != nil {
    	panic(err)
    }
    fmt.Printf("Vault overview: %v\\n", vaultOverview)
    ```
  </Tab>

  <Tab value="js" title="JavaScript">
    Use the [`vaults.getOverview()`](https://github.com/1Password/onepassword-sdk-js/blob/main/client/src/vaults.ts#L31) method with the [unique identifier (ID)](/sdks/concepts#unique-identifiers) 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](#create-a-vault).

    ```js theme={null}
    // Get vault overview
    const vaultOverview = await client.vaults.getOverview(createdVault.id);
    console.log(JSON.stringify(vaultOverview));
    ```
  </Tab>

  <Tab value="python" title="Python">
    Use the [`vaults.get_overview()`](https://github.com/1Password/onepassword-sdk-python/blob/main/src/onepassword/vaults.py#L72) method with the [unique identifier (ID)](/sdks/concepts#unique-identifiers) of a vault to retrieve high-level metadata about the vault.

    ```python theme={null}
    # Get a vault overview
    vault_overview = await client.vaults.get_overview("your-vault-id")
    print(vault_overview)
    ```
  </Tab>
</Tabs>

## Get vault details

<Tabs groupId="sdks">
  <Tab value="go" title="Go">
    Use the [`Vaults().Get()`](https://github.com/1Password/onepassword-sdk-go/blob/main/vaults.go#L102) method with the [unique identifier (ID)](/sdks/concepts#unique-identifiers) of a vault to get details about the vault.

    The following example gets details for the vault you retrieved [in the previous step](#get-a-vault-overview).

    ```go theme={null}
    // Get vault details
    vault, err := client.Vaults().Get(context.Background(), vaultOverview.ID, onepassword.VaultGetParams{})
    if err != nil {
    	panic(err)
    }
    fmt.Printf("Vault details: %v\\n", vault)
    ```
  </Tab>

  <Tab value="js" title="JavaScript">
    Use the [`vaults.get()`](https://github.com/1Password/onepassword-sdk-js/blob/main/client/src/vaults.ts#L36) method with the [unique identifier (ID)](/sdks/concepts#unique-identifiers) of a vault to get details about the vault.

    The following example gets details for the vault you created [in the first step](#create-a-vault).

    ```js theme={null}
    // Get vault details
    const vault = await client.vaults.get(createdVault.id, { accessors: false });
    console.log(JSON.stringify(vault));
    ```
  </Tab>

  <Tab value="python" title="Python">
    Use the [`vaults.get()`](https://github.com/1Password/onepassword-sdk-python/blob/main/src/onepassword/vaults.py#L91) method with the [unique identifier (ID)](/sdks/concepts#unique-identifiers) of a vault to get details about the vault. For example, to get a vault's ID and name:

    ```python theme={null}
    from onepassword import VaultGetParams

    # Get a vault
    get_params = VaultGetParams(
        accessors=True,
    )

    vault = await client.vaults.get("your-vault-id", get_params)
    print(f"Retrieved vault: {vault.id} - {vault.title}")
    ```
  </Tab>
</Tabs>

## Update a vault

<Tabs groupId="sdks">
  <Tab value="go" title="Go">
    Use the [`Vaults().Update()`](https://github.com/1Password/onepassword-sdk-go/blob/main/vaults.go#L119) method to modify the details of an existing vault. This method requires the following:

    * `vaultID`: The [unique identifier](/sdks/concepts#unique-identifiers) of the vault you want to update.
    * A [`VaultUpdateParams`](https://github.com/1Password/onepassword-sdk-go/blob/main/types.go#L1076) 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`](https://github.com/1Password/onepassword-sdk-go/blob/main/types.go#L1021) struct.

    The following example updates the name and description of the vault you created [in the first step](#create-a-vault).

    ```go theme={null}
    // Update a vault
    updateParams := onepassword.VaultUpdateParams{
    	Title:       nil,
    	Description: nil,
    }

    name := "Go SDK Updated Vault"
    description = "Updated description from Go SDK"
    updateParams.Title = &name
    updateParams.Description = &description

    // Update the vault
    updatedVault, err := client.Vaults().Update(context.Background(), createdVault.ID, updateParams)
    if err != nil {
    	panic(err)
    }
    fmt.Println("Updated Vault: ", updatedVault.Title)
    ```
  </Tab>

  <Tab value="js" title="JavaScript">
    Use the [`vaults.update()`](https://github.com/1Password/onepassword-sdk-js/blob/main/client/src/vaults.ts#L167) method to modify the details of an existing vault. This method requires the following:

    * `vaultId`: The [unique identifier](/sdks/concepts#unique-identifiers) of the vault you want to update.
    * An object that contains the new vault details:
      * `title`: The new name for the vault.
      * `description`: An updated description for the vault.

    Returns: A Promise that resolves to the updated [`Vault`](https://github.com/1Password/onepassword-sdk-js/blob/main/client/src/types.ts#L568) object.

    The following example updates the name and description of the vault you created [in the first step](#create-a-vault).

    ```js theme={null}
    // Update vault
    await client.vaults.update(createdVault.id, {
      title: "JS SDK Vault Updated",
      description: "An updated vault created via the SDK",
    });
    console.log("Updated vault", createdVault.id);
    ```
  </Tab>

  <Tab value="python" title="Python">
    Use the [`vaults.update()`](https://github.com/1Password/onepassword-sdk-python/blob/main/src/onepassword/vaults.py#L113) method to modify the details of an existing vault. This method requires the following:

    * `vault_id`: The [unique identifier](/sdks/concepts#unique-identifiers) of the vault you want to update.
    * A [`VaultUpdateParams`](https://github.com/1Password/onepassword-sdk-python/blob/main/src/onepassword/types.py#L1388) object that contains the new vault details:
      * `title`: The new name for the vault.
      * `description`: An updated description for the vault.

    Returns: The updated [`Vault`](https://github.com/1Password/onepassword-sdk-python/blob/main/src/onepassword/types.py#L1269) object.

    ```python theme={null}
    from onepassword import VaultUpdateParams

    vault_id = "your-vault-id"

    # Update a vault
    update_params = VaultUpdateParams(
        title="Python SDK Updated Name",
        description="Updated description",
    )

    updated_vault = await client.vaults.update(vault_id, update_params)
    print(
        f'Updated vault "{updated_vault.title}" ({updated_vault.id}): '
        f'{updated_vault.description!r}'
    )
    ```
  </Tab>
</Tabs>

## Delete a vault

<Tabs groupId="sdks">
  <Tab value="go" title="Go">
    To delete a vault, use the [`Vaults().Delete()`](https://github.com/1Password/onepassword-sdk-go/blob/main/vaults.go#L136) method with the [unique identifier](/sdks/concepts#unique-identifiers) of the vault you want to delete.

    The following example deletes the vault you created [in the first step](#create-a-vault).

    ```go theme={null}
    // Delete vault
    err = client.Vaults().Delete(context.Background(), createdVault.ID)
    if err != nil {
    	panic(err)
    }
    fmt.Println("Deleted vault.")
    ```
  </Tab>

  <Tab value="js" title="JavaScript">
    To delete a vault, use the [`vaults.delete()`](https://github.com/1Password/onepassword-sdk-js/blob/main/client/src/vaults.ts#L46) method with the [unique identifier](/sdks/concepts#unique-identifiers) of the vault you want to delete.

    The following example deletes the vault you created [in the first step](#create-a-vault).

    ```js theme={null}
    // Delete vault
    await client.vaults.delete(createdVault.id);
    console.log("Deleted vault", createdVault.id);
    ```
  </Tab>

  <Tab value="python" title="Python">
    To delete a vault, use the [`vaults.delete()`](https://github.com/1Password/onepassword-sdk-python/blob/main/src/onepassword/vaults.py#L135) method with the [unique identifier](/sdks/concepts#unique-identifiers) of the vault you want to delete.

    ```python theme={null}
    vault_id = "your-vault-id"

    # Delete a vault
    await client.vaults.delete(vault_id)
    print(f"Vault {vault_id} successfully deleted.")
    ```
  </Tab>
</Tabs>

<Tip>
  You can also [batch create, get, and delete items](/sdks/manage-items#manage-items-in-bulk) from a vault.
</Tip>

## Learn more

* [Manage items in bulk](/sdks/manage-items#manage-items-in-bulk)
* [Manage vault permissions](/sdks/vault-permissions)
* [List vaults and items](/sdks/list-vaults-items)
* [Workflow: Build integrations with 1Password](/get-started/build-integrations)
* [Workflow: Programmatically manage your organization](/get-started/manage-organization)
