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

# Replace a sandbox network policy

> Replaces the complete outbound network policy of a running sandbox. The response confirms the accepted policy; enforcement on the sandbox node converges asynchronously.



## OpenAPI

````yaml /api-reference/openapi.yaml patch /sandboxes/{id}/network-policy
openapi: 3.1.0
info:
  title: Thunder Sandbox API
  version: '1.0'
  description: Create, inspect, list, update, access, and stop Thunder sandboxes.
  contact:
    name: Thunder Compute Support
    url: https://www.thundercompute.com/contact
    email: support@thundercompute.com
servers:
  - url: https://api.thundercompute.com:8443/v1
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Sandboxes
    description: Short-lived isolated compute environments.
paths:
  /sandboxes/{id}/network-policy:
    patch:
      tags:
        - Sandboxes
      summary: Replace a sandbox network policy
      description: >-
        Replaces the complete outbound network policy of a running sandbox. The
        response confirms the accepted policy; enforcement on the sandbox node
        converges asynchronously.
      operationId: updateSandboxNetworkPolicy
      parameters:
        - $ref: '#/components/parameters/SandboxID'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SandboxNetworkPolicyUpdateRequest'
            example:
              network_policy:
                internet_access: restricted
                domain_allowlist:
                  - pypi.org
                  - files.pythonhosted.org
      responses:
        '202':
          description: Policy accepted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SandboxNetworkPolicyUpdateResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
        '503':
          $ref: '#/components/responses/Unavailable'
components:
  parameters:
    SandboxID:
      name: id
      in: path
      required: true
      description: Permanent API-assigned sandbox ID.
      schema:
        type: string
        pattern: ^sbx-[a-f0-9]{16}$
      example: sbx-0123456789abcdef
  schemas:
    SandboxNetworkPolicyUpdateRequest:
      type: object
      required:
        - network_policy
      properties:
        network_policy:
          $ref: '#/components/schemas/SandboxNetworkPolicy'
    SandboxNetworkPolicyUpdateResponse:
      type: object
      required:
        - id
        - network_policy
      properties:
        id:
          type: string
          description: Permanent sandbox ID.
          example: sbx-0123456789abcdef
        network_policy:
          $ref: '#/components/schemas/SandboxNetworkPolicy'
    SandboxNetworkPolicy:
      type: object
      required:
        - internet_access
      properties:
        internet_access:
          type: string
          enum:
            - closed
            - open
            - restricted
          description: >-
            closed blocks external egress; open permits public internet;
            restricted enforces the supplied CIDR and domain controls.
        cidr_allowlist:
          type: array
          description: IPv4 CIDRs reachable under restricted access.
          items:
            type: string
            example: 203.0.113.0/24
        domain_allowlist:
          type: array
          description: >-
            DNS names resolvable under restricted access. A bare name is exact;
            *.example.com includes subdomains; * permits all names.
          items:
            type: string
            example: '*.example.com'
    Error:
      type: object
      required:
        - error
        - message
        - code
      properties:
        error:
          type: string
          description: Stable machine-readable error code.
          example: invalid_request
        message:
          type: string
          description: Human-readable explanation.
          example: Invalid request body
        code:
          type: integer
          description: HTTP status code.
          example: 400
  responses:
    BadRequest:
      description: Invalid request or pagination parameters.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing, invalid, or expired bearer token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: The organization lacks sandbox access.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: The sandbox ID is unknown in the organization.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Conflict:
      description: Name is in use or another operation conflicts.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    TooManyRequests:
      description: Rate limit exceeded. Honor the Retry-After header.
      headers:
        Retry-After:
          description: Seconds until another request should be attempted.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalError:
      description: Sandbox request failed unexpectedly.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unavailable:
      description: >-
        Capacity, access verification, control plane, or scheduler is
        unavailable.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API token
      description: API token created in the Thunder console.

````