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

# Set a secret's allowed hosts

> Replaces the hosts a secret may be sent to. Narrowing takes effect at
once: a binding whose host is no longer on the list stops working, and
a rule naming that host is refused with 403. A secret stored before
allowed hosts existed has an empty list and cannot be used until one is
set here. Owners and admins, or unrestricted API keys (no scopes and no
sandbox list).




## OpenAPI

````yaml /api-reference/anona-openapi.yaml put /v1/vault/secrets/{name}/allowed-hosts
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.
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/{name}/allowed-hosts:
    put:
      tags:
        - Credential vault
      summary: Set a secret's allowed hosts
      description: |
        Replaces the hosts a secret may be sent to. Narrowing takes effect at
        once: a binding whose host is no longer on the list stops working, and
        a rule naming that host is refused with 403. A secret stored before
        allowed hosts existed has an empty list and cannot be used until one is
        set here. Owners and admins, or unrestricted API keys (no scopes and no
        sandbox list).
      operationId: setVaultAllowedHosts
      parameters:
        - name: name
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - allowedHosts
              additionalProperties: false
              properties:
                allowedHosts:
                  $ref: '#/components/schemas/VaultAllowedHosts'
            example:
              allowedHosts:
                - api.github.com
                - uploads.github.com
      responses:
        '200':
          description: >-
            The secret with its new list, and its bindings as the list shows
            them.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VaultSecret'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    VaultAllowedHosts:
      type: array
      minItems: 1
      maxItems: 64
      items:
        type: string
      description: |
        The hosts this secret may be sent to. Each entry is one of:
        an exact host (`api.github.com`, that host only); `*.` and a domain
        (`*.github.com`, any host under `github.com` but not `github.com`
        itself, so list both when you need both); or `*` on its own, for any
        host. Entries are bare host names: no scheme, port or path. A rule
        that aims the secret at a host outside the list is refused with 403.
      example:
        - api.github.com
    VaultSecret:
      type: object
      required:
        - name
        - version
        - allowedHosts
        - createdAt
        - updatedAt
        - bindings
      properties:
        name:
          type: string
        version:
          type: integer
        allowedHosts:
          type: array
          items:
            type: string
          description: >-
            The hosts this secret may be sent to. Empty for a secret stored
            before allowed hosts existed, which cannot be used until a list is
            set.
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        bindings:
          type: array
          nullable: true
          description: >
            Where the secret is in use: one entry per host and header. A rule in

            a sandbox's create request or network update is bound for that

            sandbox alone (`scope` `sandbox`, `scopeID` the sandbox ID), so two

            sandboxes with the same rule have two bindings. A rule in the team

            egress settings or a template's policy is bound once (`scope`

            `tenant_default` or `template`) and used by every sandbox under it.

            A sandbox's own bindings are revoked when it ends (deleted, timed
            out

            or failed) and drop out of this list; a paused sandbox keeps them.
          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'
    Unauthorized:
      description: No valid API key or session.
      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'
    NotFound:
      description: >-
        Not found, or not yours (the answer is the same, so IDs cannot be
        probed).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        An Anona Compute API key (`ac_` followed by lowercase hex; older keys
        start with `e2b_`).
    BearerAuth:
      type: http
      scheme: bearer
      description: 'The same API key, sent as `Authorization: Bearer ac_...`.'

````

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