> ## Documentation Index
> Fetch the complete documentation index at: https://e2b-automation-api-reference-update.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Update a secret

> Replace the secret's stored marker by appending a new version. The response carries metadata only.



## OpenAPI

````yaml /openapi-public.yml post /secrets/{secretID}
openapi: 3.1.0
info:
  title: E2B API
  version: 0.1.0
  description: >-
    Complete E2B developer API. Platform endpoints are served on api.e2b.app.
    Sandbox endpoints (envd) are served on the shared sandbox host
    (sandbox.e2b.app); target a specific sandbox with the E2b-Sandbox-Id and
    E2b-Sandbox-Port headers.
servers:
  - url: https://api.e2b.app
    description: E2B Platform API
security: []
tags:
  - name: Sandboxes
  - name: Templates
  - name: Tags
  - name: Volumes
  - name: Envd
  - name: Filesystem
  - name: Process
  - name: Teams
paths:
  /secrets/{secretID}:
    servers:
      - url: https://api.e2b.app
        description: E2B Platform API
    post:
      tags:
        - secrets
      summary: Update a secret
      description: >-
        Replace the secret's stored marker by appending a new version. The
        response carries metadata only.
      operationId: postSecret
      parameters:
        - $ref: '#/components/parameters/secretID'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SecretUpdate'
      responses:
        '200':
          description: Successfully updated the secret
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Secret'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '404':
          $ref: '#/components/responses/404'
        '409':
          $ref: '#/components/responses/409'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '502':
          $ref: '#/components/responses/502'
        '504':
          $ref: '#/components/responses/504'
      security:
        - ApiKeyAuth: []
components:
  parameters:
    secretID:
      name: secretID
      in: path
      required: true
      schema:
        type: string
        description: >
          Identifier of the secret (sec_ prefixed), or its canonical lower-case
          name
  schemas:
    SecretUpdate:
      type: object
      required:
        - value
      properties:
        value:
          type: string
          description: >-
            Runtime marker stored as the secret's new version. The runtime
            resolves it to a value at sandbox egress.
        metadata:
          $ref: '#/components/schemas/SecretMetadata'
    Secret:
      type: object
      description: Metadata of a secret. It never carries the secret value.
      required:
        - secretID
        - name
        - currentVersion
        - metadata
        - createdAt
        - updatedAt
      properties:
        secretID:
          type: string
          description: Identifier of the secret
        name:
          type: string
          description: Name of the secret, unique within the project
        currentVersion:
          type: integer
          format: int64
          description: Version served to readers that do not name one
        metadata:
          $ref: '#/components/schemas/SecretMetadata'
        createdAt:
          type: string
          format: date-time
          description: Time when the secret was created
        updatedAt:
          type: string
          format: date-time
          description: Time when the secret was last updated
    SecretMetadata:
      type: object
      description: >
        Customer metadata of the secret. Always present, empty when unset. At
        most 32 entries; keys are limited to 128 bytes, values to 1024 bytes,
        and a secret's metadata to 8192 bytes in total.
      maxProperties: 32
      additionalProperties:
        type: string
        maxLength: 1024
    Error:
      required:
        - code
        - message
      properties:
        code:
          type: integer
          format: int32
          description: Error code
        error_code:
          type: string
          description: >-
            Machine-readable semantic error code. Not a closed set; initial
            values: sandbox_capacity_unavailable, sandbox_placement_timeout,
            sandbox_no_compatible_node, sandbox_create_failed,
            internal_server_error.
        message:
          type: string
          description: Error
      type: object
  responses:
    '400':
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '401':
      description: Authentication error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '403':
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '404':
      description: Not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '409':
      description: Conflict
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '429':
      description: Too many requests
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '500':
      description: Server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '502':
      description: Backend error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '504':
      description: Backend timeout
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````