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

# Update sandbox

> Update mutable sandbox fields. Currently `autoSleep` is the only allowed field. Unknown or immutable keys are rejected. The change takes effect on the next auto-lifecycle scan and does not restart the VM. Disabling autoSleep does not cancel auto-delete of an already-snapshotted sandbox.



## OpenAPI

````yaml /openapi/voidrun.yml patch /sandboxes/{id}
openapi: 3.0.3
info:
  title: VoidRun API
  description: >
    VoidRun API provides comprehensive management of virtual machines
    (sandboxes), 

    file system operations, execution environments, and organizational
    resources.


    All endpoints except `/api/version` require the `X-API-Key` header for
    authentication.
  version: 1.0.0
  contact:
    name: VoidRun Support
  license:
    name: Proprietary
servers:
  - url: https://api.void-run.com/api
    description: Production server
security: []
tags:
  - name: System
    description: Service metadata endpoints
  - name: Organizations
    description: Organization and API key management
  - name: Users
    description: User profile and management
  - name: Sandboxes
    description: Virtual machine (sandbox) lifecycle management
  - name: Execution
    description: Command execution and PTY session management
  - name: File System
    description: File and directory operations
  - name: Images
    description: Base image management
paths:
  /sandboxes/{id}:
    patch:
      tags:
        - Sandboxes
      summary: Update sandbox
      description: >-
        Update mutable sandbox fields. Currently `autoSleep` is the only allowed
        field. Unknown or immutable keys are rejected. The change takes effect
        on the next auto-lifecycle scan and does not restart the VM. Disabling
        autoSleep does not cancel auto-delete of an already-snapshotted sandbox.
      operationId: updateSandbox
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          example: 65ae1234567890abcdef1234
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSandboxRequest'
      responses:
        '200':
          description: Sandbox updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponseSandbox'
        '400':
          description: Invalid request (empty body, unknown field, or no updatable fields)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Sandbox not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    UpdateSandboxRequest:
      type: object
      additionalProperties: false
      minProperties: 1
      properties:
        autoSleep:
          type: boolean
          description: >-
            If true, auto-snapshot after idle. If false, skip idle snapshot.
            Takes effect on the next lifecycle scan. Does not cancel auto-delete
            of an already-snapshotted sandbox.
          example: true
    ApiResponseSandbox:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          nullable: true
          example: Sandbox details fetched successfully
        data:
          $ref: '#/components/schemas/Sandbox'
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          example: Invalid request
        details:
          type: string
          example: Additional error details
    Sandbox:
      type: object
      properties:
        id:
          type: string
          example: 65ae1234567890abcdef1234
        name:
          type: string
          example: vm-01
        image:
          type: string
          description: Resolved image in `name:ver` format
          example: code:1.0.42
        cpu:
          type: integer
          description: Number of vCPUs allocated
          example: 2
        mem:
          type: integer
          description: Memory in MiB
          example: 2048
        diskMB:
          type: integer
          description: Disk size in MiB
          example: 10240
        status:
          type: string
          description: >-
            Lifecycle state. Terminal states `killed` and `deleted` may still
            appear in list responses for historical or cleanup rows.
          enum:
            - running
            - snapshotted
            - error
            - killed
            - deleted
          example: running
        createdAt:
          type: string
          format: date-time
        createdBy:
          type: string
          description: User ID who created the sandbox
          example: 65ae1234567890abcdef1234
        orgId:
          type: string
          description: Organization ID the sandbox belongs to
          example: 65ae1234567890abcdef1234
        envVars:
          type: object
          additionalProperties:
            type: string
          description: >-
            Environment variables set on the sandbox (optional, only present if
            configured)
          example:
            DEBUG: 'true'
            LOG_LEVEL: info
        autoSleep:
          type: boolean
          description: Indicates if auto-sleep is enabled
          example: true
        region:
          type: string
          description: Region where the sandbox is hosted
          example: us-east-1
        nodeId:
          type: string
          description: Voidrun host that created this sandbox
          example: host-fra-01
        publishPorts:
          type: array
          items:
            type: integer
            minimum: 1
            maximum: 65535
          description: >-
            Ports exposed through the public gateway. Empty when the sandbox is
            not publicly reachable.
          example:
            - 8080
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: 'API key for authentication (format: vr_...)'

````

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