> ## Documentation Index
> Fetch the complete documentation index at: https://hyperbrowser.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Update a vault

> Change a vault's description, entries or 1Password settings.

See the [vaults guide](/docs/sandboxes/vaults) for SDK and CLI examples.


## OpenAPI

````yaml openapi.json PATCH /api/vaults/{id}
openapi: 3.0.1
info:
  title: Hyperbrowser API
  version: 1.0.0
servers:
  - url: https://api.hyperbrowser.ai
    description: Production server
security: []
paths:
  /api/vaults/{id}:
    patch:
      summary: Update a vault
      description: >-
        Changes a vault's description, entries, or 1Password settings. Entries
        you pass replace those variables and `null` removes one; others are
        kept. Processes that already started keep the values they received.
        Secrets are enabled for teams on request; please contact support to
        enable them (otherwise 403 SECRETS_FEATURE_DISABLED). Restricted API
        keys need the secrets.manage scope. When you're signed in rather than
        using an API key, you must be a team owner or admin (otherwise 403
        SECRETS_ADMIN_REQUIRED).
      operationId: updateVault
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Vault ID.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateVaultParams'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Vault'
        '400':
          description: >-
            Invalid request body, nothing to change, VAULT_ENTRY_INVALID, or
            VAULT_SOURCE_INVALID (source settings on a stored vault).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SecretErrorResponse'
        '401':
          description: Authentication required.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SecretErrorResponse'
        '403':
          description: >-
            API_KEY_SCOPE_DENIED (the API key lacks a required scope),
            SECRETS_FEATURE_DISABLED, or SECRETS_ADMIN_REQUIRED.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SecretErrorResponse'
        '404':
          description: VAULT_NOT_FOUND, SECRET_NOT_FOUND, or SECRET_VERSION_NOT_FOUND.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SecretErrorResponse'
        '409':
          description: VAULT_ENTRY_LIMIT_REACHED or SECRET_TYPE_MISMATCH.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SecretErrorResponse'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SecretErrorResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    UpdateVaultParams:
      type: object
      description: Provide at least one of `description`, `source` and `entries`.
      properties:
        description:
          type: string
          maxLength: 1024
          description: Replaces the description. Trimmed before it's stored.
        source:
          type: object
          description: >-
            A 1Password vault's settings to change. A stored vault returns 400
            VAULT_SOURCE_INVALID, and the source type can't change.
          properties:
            tokenSecret:
              type: string
              pattern: ^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$
              description: Name of an `op_token` secret.
            vault:
              type: string
              minLength: 1
              maxLength: 256
              description: The 1Password vault's name or ID.
          additionalProperties: false
        entries:
          type: object
          additionalProperties:
            oneOf:
              - $ref: '#/components/schemas/VaultStoredEntry'
              - $ref: '#/components/schemas/VaultOnePasswordEntry'
              - type: object
                nullable: true
                enum:
                  - null
                description: '`null` removes the variable.'
          description: >-
            Entries to change: each one given replaces that variable, `null`
            removes it, and variables not given are kept. Keys are environment
            variable names: letters, digits and `_`, not starting with a digit,
            at most 256 characters. A vault holds at most 32 entries (otherwise
            409 VAULT_ENTRY_LIMIT_REACHED).
      minProperties: 1
      additionalProperties: false
    Vault:
      type: object
      description: A named set of environment variables. Holds no values.
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
          pattern: ^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$
          description: >-
            1-128 letters, digits, `_` or `-`, starting with a letter or digit.
            Unique within your team.
        description:
          type: string
          maxLength: 1024
        source:
          $ref: '#/components/schemas/VaultSource'
        entries:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/VaultEntry'
          description: Environment variable name to entry.
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
      required:
        - id
        - name
        - description
        - entries
        - createdAt
        - updatedAt
    SecretErrorResponse:
      type: object
      properties:
        code:
          type: string
          description: Machine-readable error code, such as SECRET_NOT_FOUND.
        message:
          type: string
        error:
          type: string
          description: >-
            Set instead of `code` by authentication and API key scope errors
            (API_KEY_SCOPE_DENIED).
        requiredScopes:
          type: array
          items:
            type: string
          description: The scope the API key is missing, with API_KEY_SCOPE_DENIED.
        retryable:
          type: boolean
          description: >-
            Whether repeating the same request can succeed. Set on delivery
            errors.
        details:
          type: object
          additionalProperties: true
          description: >-
            Extra information for some codes, such as `origin` for
            CREDENTIAL_ORIGIN_NOT_ALLOWED or `pages` for
            CREDENTIAL_PAGE_AMBIGUOUS.
      description: >-
        HTTP failure. Secret errors include `code` and `message`; request
        validation errors include only `message`; API key scope errors include
        `error`, `message` and `requiredScopes`.
    VaultStoredEntry:
      type: object
      description: 'An entry of a stored vault: a secret, by name.'
      properties:
        name:
          type: string
          pattern: ^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$
          description: Name of a `secret` or `totp` secret.
        version:
          oneOf:
            - type: string
              enum:
                - latest
            - type: integer
              minimum: 1
              maximum: 2147483647
          description: A version to pin, or `latest`. Omit to follow the latest version.
      required:
        - name
      additionalProperties: false
    VaultOnePasswordEntry:
      type: object
      description: >-
        An entry of a 1Password vault: a field of an item in the linked
        1Password vault, read as `op://<vault>/<item>/[<section>/]<field>`. The
        reference can be at most 512 bytes.
      properties:
        item:
          type: string
          minLength: 1
          maxLength: 256
          description: >-
            The item. 1-256 characters; a 1Password name or ID without `/` or
            `?`, and not `.` or `..`.
        section:
          type: string
          minLength: 1
          maxLength: 256
          description: >-
            The section, if any. 1-256 characters; a 1Password name or ID
            without `/` or `?`, and not `.` or `..`.
        field:
          type: string
          minLength: 1
          maxLength: 256
          description: >-
            The field. 1-256 characters; a 1Password name or ID without `/` or
            `?`, and not `.` or `..`. It may end with a query such as
            `?attribute=otp`, which reads a TOTP field's current code.
      required:
        - item
        - field
      additionalProperties: false
    VaultSource:
      type: object
      description: >-
        Where the vault's values come from. `stored`: your secrets. `1password`:
        a linked 1Password vault, read with the service account token in
        `tokenSecret`. Treat a missing `source` as `stored`.
      properties:
        type:
          type: string
          enum:
            - stored
            - 1password
        tokenSecret:
          type: object
          description: The `op_token` secret, for 1Password vaults.
          properties:
            name:
              type: string
            secretId:
              type: string
              format: uuid
          required:
            - name
            - secretId
        vault:
          type: string
          description: The 1Password vault's name or ID, for 1Password vaults.
      required:
        - type
    VaultEntry:
      description: >-
        An entry as returned. A stored vault's entry has the secret's `name`,
        `secretId` and pinned `version` (`null` follows the latest). A 1Password
        vault's entry has `item`, `section`, `field` and the `reference` built
        from them.
      type: object
      properties:
        name:
          type: string
        secretId:
          type: string
          format: uuid
        version:
          type: integer
          nullable: true
        item:
          type: string
        section:
          type: string
        field:
          type: string
        reference:
          type: string
          description: The `op://` reference read from 1Password.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.