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

# Store a secret

> Stores a secret, encrypted at rest. Reference it from a network rule as
`${vault.<name>}`; the egress proxy adds it to requests to that host, and
the sandbox never sees the value. Owners and admins, or unrestricted keys.




## OpenAPI

````yaml /compute/api-reference/anona-openapi.yaml post /v1/vault/secrets
openapi: 3.0.3
info:
  title: Anona Compute API (Anona routes)
  version: 0.1.0
  description: >
    Routes the Anona Compute gateway serves next to the E2B-compatible API:

    live-view viewer tokens, SSH certificates, network policy, the credential

    vault, usage and billing, webhooks and telemetry export, thumbnails, preview
    links,

    public ports, pause when idle, template builds, and API key management.


    Written from the gateway handlers
    (`gateway/internal/stream/token/handlers.go`,

    `gateway/internal/sshca/handler.go`,
    `gateway/internal/handlers/apikeys/apikeys.go`)

    and checked against a running gateway by
    `docs-site/scripts/verify_openapi.py`.
servers:
  - url: https://api.compute.anonalabs.com
security:
  - ApiKeyAuth: []
  - BearerAuth: []
tags:
  - name: Live view
  - name: SSH
  - name: Sandbox access
  - name: Templates
  - name: Network
  - name: Credential vault
  - name: Usage and billing
  - name: Webhooks and telemetry
  - name: API keys
  - name: Service
paths:
  /v1/vault/secrets:
    post:
      tags:
        - Credential vault
      summary: Store a secret
      description: >
        Stores a secret, encrypted at rest. Reference it from a network rule as

        `${vault.<name>}`; the egress proxy adds it to requests to that host,
        and

        the sandbox never sees the value. Owners and admins, or unrestricted
        keys.
      operationId: createVaultSecret
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - value
              additionalProperties: false
              properties:
                name:
                  type: string
                  pattern: ^[a-z][a-z0-9_]{0,62}$
                value:
                  type: string
                  maxLength: 8192
            example:
              name: openai_key
              value: sk-...
      responses:
        '201':
          description: Stored. The value is not echoed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VaultSecret'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          description: A secret with this name exists; add a version to rotate it.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: The vault is not configured on this deployment.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    VaultSecret:
      type: object
      required:
        - name
        - version
        - createdAt
        - updatedAt
        - bindings
      properties:
        name:
          type: string
        version:
          type: integer
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        bindings:
          type: array
          nullable: true
          items:
            type: object
            required:
              - id
              - secret
              - scope
              - scopeID
              - host
              - header
              - format
            properties:
              id:
                type: string
              secret:
                type: string
              scope:
                type: string
                enum:
                  - tenant_default
                  - template
                  - sandbox
              scopeID:
                type: string
              host:
                type: string
              header:
                type: string
              format:
                type: string
                example: Bearer ${SECRET}
              createdAt:
                type: string
                format: date-time
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: integer
          description: The HTTP status code.
        message:
          type: string
        error_code:
          type: string
          description: >-
            Machine-readable reason, on some errors (for example
            `invalid_request`).
  responses:
    BadRequest:
      description: The request body is invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: The key's scopes or the caller's role do not allow this.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: An Anona Compute API key (`e2b_` followed by lowercase hex).
    BearerAuth:
      type: http
      scheme: bearer
      description: 'The same API key, sent as `Authorization: Bearer e2b_...`.'

````

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