> ## 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.

# Delete a secret version

> Permanently delete an older version of a secret.

See the [secrets guide](/docs/sandboxes/secrets) for SDK and CLI examples, and [credential fill](/docs/sessions/credentials) for website logins.


## OpenAPI

````yaml openapi.json DELETE /api/secrets/{id}/versions/{version}
openapi: 3.0.1
info:
  title: Hyperbrowser API
  version: 1.0.0
servers:
  - url: https://api.hyperbrowser.ai
    description: Production server
security: []
paths:
  /api/secrets/{id}/versions/{version}:
    delete:
      summary: Delete a secret version
      description: >-
        Permanently deletes an older version of a secret. You can't delete the
        latest version: add a new version or delete the secret instead. 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: deleteSecretVersion
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Secret ID.
        - name: version
          in: path
          required: true
          schema:
            type: integer
            minimum: 1
            maximum: 2147483647
          description: Version number.
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SecretVersionDeleteResponse'
        '400':
          description: Invalid secret ID or version.
          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: SECRET_NOT_FOUND or SECRET_VERSION_NOT_FOUND.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SecretErrorResponse'
        '409':
          description: >-
            SECRET_VERSION_IS_LATEST: the latest version can't be deleted.
            SECRET_VERSION_IN_USE: a vault pins this version.
          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:
    SecretVersionDeleteResponse:
      type: object
      properties:
        deleted:
          type: boolean
          enum:
            - true
        version:
          type: integer
      required:
        - deleted
        - version
    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`.
  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.