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

# Update sandbox network

> Update the network configuration for a running sandbox. Replaces the current egress rules with the provided configuration. Omitting field clears it.

Anona: the update replaces the sandbox's policy and goes through the same platform floor and plan limits as a create. An update without `allow_internet_access` keeps the sandbox's current internet setting. `egressProxy` is refused with 400, as on create. A rule in `rules` that needs a new credential binding needs the same permission as on create (see Networking).



## OpenAPI

````yaml /api-reference/e2b-openapi.yaml put /sandboxes/{sandboxID}/network
openapi: 3.0.0
info:
  title: Anona Compute API (E2B-compatible routes)
  version: 0.1.0
  description: >-
    The E2B-compatible API operations the Anona Compute gateway serves, for use
    with the E2B SDK.
servers:
  - url: https://api.compute.anonalabs.com
security: []
tags:
  - name: sandboxes
paths:
  /sandboxes/{sandboxID}/network:
    put:
      tags:
        - sandboxes
      summary: Update sandbox network
      description: >-
        Update the network configuration for a running sandbox. Replaces the
        current egress rules with the provided configuration. Omitting field
        clears it.


        Anona: the update replaces the sandbox's policy and goes through the
        same platform floor and plan limits as a create. An update without
        `allow_internet_access` keeps the sandbox's current internet setting.
        `egressProxy` is refused with 400, as on create. A rule in `rules` that
        needs a new credential binding needs the same permission as on create
        (see Networking).
      parameters:
        - $ref: '#/components/parameters/sandboxID'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SandboxNetworkUpdateConfig'
      responses:
        '204':
          description: Successfully updated the sandbox network configuration
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '403':
          description: Your role or API key may not change this sandbox
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          $ref: '#/components/responses/404'
        '409':
          $ref: '#/components/responses/409'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
      security:
        - ApiKeyAuth: []
components:
  parameters:
    sandboxID:
      name: sandboxID
      in: path
      required: true
      schema:
        type: string
  schemas:
    SandboxNetworkUpdateConfig:
      type: object
      description: >-
        Network configuration update for a running sandbox. Replaces the current
        egress rules with the provided configuration. Omitting a field clears
        it.
      properties:
        allowOut:
          type: array
          description: >-
            Destinations to allow: IPv4 addresses, CIDR blocks (e.g.
            "203.0.113.0/24") and exact host names (e.g. "api.example.com").
            Allowed entries take precedence over denied entries. Anona: a host
            name needs public egress off (`allow_internet_access: false`, or
            `0.0.0.0/0` in `denyOut`). Wildcard names such as `*.example.com`
            are refused with 400 (wildcard host names are not supported yet;
            name exact hosts), and so are names that do not resolve yet and
            destinations in private or reserved ranges, including names that
            resolve into them. The sandbox's DNS resolvers, 1.1.1.1 and 1.0.0.1,
            are always allowed.
          items:
            type: string
        denyOut:
          type: array
          description: >-
            List of denied CIDR blocks or IP addresses for egress traffic.
            Domain names are not supported for deny rules.
          items:
            type: string
        dnsServers:
          type: array
          maxItems: 10
          description: >-
            Anona: sandboxes resolve names through 1.1.1.1 and 1.0.0.1, which
            are always allowed, and this field does not change that or the
            sandbox's /etc/resolv.conf. Any other IPv4 address listed here is
            added to the allowed destinations when `allowOut` has a host name
            and public egress is off; otherwise it is accepted and has no
            effect. The free plan accepts only 1.1.1.1 and 1.0.0.1, and an
            address in a reserved range is refused with 400.
          items:
            type: string
        egressProxy:
          type: object
          nullable: true
          description: >-
            Not supported on Anona. Any value other than `null` is refused with
            400 (`SOCKS5 egress proxies are not supported`), on create and on
            update.
        rules:
          type: object
          description: >-
            Per-host header rules for the sandbox's outbound HTTPS requests.
            Anona: each key is one exact host name, normalized to lowercase. A
            wildcard key such as `*.example.com` is refused with 400 (`a
            wildcard is not allowed here; name the exact host`), and so is an IP
            address. Rules apply to HTTPS only. A rule does not allow the host
            on its own: with public egress off, list the host in `allowOut` too,
            or the rule is dropped with a warning. The host must be on the
            secret's allowed hosts (403 otherwise), and a rule that needs a new
            credential binding needs a caller who may create one (403
            otherwise); see Networking.
          additionalProperties:
            type: array
            items:
              $ref: '#/components/schemas/SandboxNetworkRule'
        allow_internet_access:
          type: boolean
          description: >-
            Allow sandbox to access the internet. When set to false, it behaves
            the same as specifying denyOut to 0.0.0.0/0 in the network config.
    Error:
      required:
        - code
        - message
      properties:
        code:
          type: integer
          format: int32
          description: Error code
        error_code:
          type: string
          description: >-
            Machine-readable error code. Not a closed set; the gateway sends
            plan_limit_exceeded (a plan limit; the body also has limit_name,
            limit, current and plan), rate_limited (a rate limit, with
            Retry-After), sandbox_quota_exceeded (a platform cap that is not a
            plan limit: fork checkpoints, builds in progress), credit_exhausted
            (the credit is spent), sandbox_snapshot_storage_full (pause and fork
            cannot store a snapshot; retrying does not help),
            template_not_found, template_not_ready (the template exists but
            cannot start a sandbox), sandbox_capacity_unavailable,
            sandbox_engine_starting and sandbox_engine_unavailable (retry after
            Retry-After), sandbox_create_failed (retry), sandbox_create_refused,
            invalid_request and internal_server_error.
        message:
          type: string
          description: Error
    SandboxNetworkRule:
      type: object
      description: Transform rule applied to egress requests matching a domain pattern.
      properties:
        transform:
          $ref: '#/components/schemas/SandboxNetworkTransform'
    SandboxNetworkTransform:
      type: object
      description: Transformations applied to matching egress requests before forwarding.
      properties:
        headers:
          type: object
          description: >-
            HTTP headers to set on matching requests; an existing header with
            the same name is replaced. Anona: every value must be one credential
            vault placeholder, `${vault.<name>}`, optionally after `Bearer ` or
            `Basic `. The egress proxy fills it in on the way out, and the
            sandbox never sees the value. A literal value is refused with 400
            (`value must be ${vault.<name>}, optionally prefixed by "Bearer " or
            "Basic "; literal values are not accepted`), as is a value with more
            than one placeholder and an empty `headers` object
            (`transform.headers: empty`). `Host`, `Content-Length`,
            `Transfer-Encoding`, `Connection`, `Upgrade`, `TE`, `Trailer`,
            `Keep-Alive` and `Proxy-*` headers cannot be set.
          additionalProperties:
            type: string
  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'
    '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
      headers:
        Retry-After:
          description: >-
            When present, the number of seconds to wait before retrying the
            request.
          required: false
          schema:
            type: integer
            minimum: 0
          example: 30
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '500':
      description: Server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  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.