> ## 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.

# Start a sandbox

> Creates an immutable sandbox and returns as soon as startup is accepted. Poll the returned ID until its status is running or failed.



## OpenAPI

````yaml /api-reference/openapi.yaml post /sandboxes/start
openapi: 3.1.0
info:
  title: Thunder Sandbox API
  version: '1.0'
  description: Create, inspect, list, 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/start:
    post:
      tags:
        - Sandboxes
      summary: Start a sandbox
      description: >-
        Creates an immutable sandbox and returns as soon as startup is accepted.
        Poll the returned ID until its status is running or failed.
      operationId: startSandbox
      requestBody:
        required: true
        description: >-
          Resources, lifetime, network policy, environment, and immutable SSH
          key.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SandboxStartRequest'
            example:
              name: training-run
              spec:
                cpu_count: 4
                memory_gib: 32
                storage_gib: 50
                gpu_type: H100
                gpu_count: 1
              env:
                RUN_ID: '42'
              lifetime:
                enforce_ttl: true
                max_ttl_seconds: 3600
              network_policy:
                internet_access: open
              ssh_public_key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIExampleReplaceWithYourKey
      responses:
        '202':
          description: Startup accepted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SandboxStartResponse'
              example:
                id: sbx-0123456789abcdef
                name: training-run
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
        '503':
          $ref: '#/components/responses/Unavailable'
        '504':
          $ref: '#/components/responses/GatewayTimeout'
components:
  schemas:
    SandboxStartRequest:
      type: object
      required:
        - spec
        - lifetime
        - network_policy
        - ssh_public_key
      properties:
        name:
          type: string
          maxLength: 64
          description: >-
            Optional display label. It must be unique among live sandboxes and
            cannot be used in place of the ID. It must be printable, have no
            leading or trailing whitespace or slash, and cannot be ., .., or a
            value surrounded by double underscores.
        spec:
          $ref: '#/components/schemas/SandboxResourceSpec'
        env:
          type: object
          description: Environment variables installed for SSH sessions.
          propertyNames:
            pattern: ^[A-Za-z_][A-Za-z0-9_]*$
          additionalProperties:
            type: string
        lifetime:
          $ref: '#/components/schemas/SandboxLifetime'
        network_policy:
          $ref: '#/components/schemas/SandboxNetworkPolicy'
        ssh_public_key:
          type: string
          description: One-line OpenSSH public key. It cannot be replaced after creation.
    SandboxStartResponse:
      type: object
      required:
        - id
        - name
      properties:
        id:
          type: string
          description: Permanent identifier for every later request.
          example: sbx-0123456789abcdef
        name:
          type: string
          description: Display label, or the ID when no name was supplied.
          example: training-run
    SandboxResourceSpec:
      type: object
      required:
        - cpu_count
        - memory_gib
        - storage_gib
      description: >-
        GPU type and count must be supplied together. Supported types and ranges
        depend on the organization's sandbox configuration.
      properties:
        cpu_count:
          type: integer
          format: uint32
          minimum: 1
          description: Number of vCPUs.
        memory_gib:
          type: integer
          format: uint32
          minimum: 1
          description: Memory in GiB.
        storage_gib:
          type: integer
          format: uint32
          minimum: 1
          description: Ephemeral disk size in GiB.
        gpu_type:
          type: string
          description: GPU type such as H100. Omit with gpu_count for CPU-only.
        gpu_count:
          type: integer
          format: uint32
          minimum: 1
          description: Number of GPUs. Supply together with gpu_type.
    SandboxLifetime:
      type: object
      required:
        - enforce_ttl
      properties:
        enforce_ttl:
          type: boolean
          description: Whether Thunder automatically stops the sandbox.
        max_ttl_seconds:
          type: integer
          format: uint32
          minimum: 0
          description: >-
            Lifetime from creation in seconds. Use a positive value when
            enforce_ttl is true.
        max_grace_seconds:
          type: integer
          format: uint32
          minimum: 0
          description: >-
            Requested graceful-shutdown budget in seconds; the platform may
            enforce a lower limit.
    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: Sandbox access is not enabled for 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'
    GatewayTimeout:
      description: Scheduler did not respond in time and the sandbox was not started.
      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.

````