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

# Create Sandbox

> Create a new sandbox with specified configuration

Creates a new sandbox instance with the specified configuration including resources, environment variables, and network settings.

## Headers

<ParamField header="X-Daytona-Organization-ID" type="string">
  Use with JWT to specify the organization ID
</ParamField>

## Body Parameters

<ParamField body="name" type="string">
  The name of the sandbox. If not provided, the sandbox ID will be used as the name

  **Example:** `MySandbox`
</ParamField>

<ParamField body="snapshot" type="string">
  The ID or name of the snapshot used for the sandbox

  **Example:** `ubuntu-4vcpu-8ram-100gb`
</ParamField>

<ParamField body="user" type="string">
  The user associated with the sandbox

  **Example:** `daytona`
</ParamField>

<ParamField body="env" type="object">
  Environment variables for the sandbox as key-value pairs

  **Example:** `{"NODE_ENV": "production"}`
</ParamField>

<ParamField body="labels" type="object">
  Labels for the sandbox as key-value pairs

  **Example:** `{"daytona.io/public": "true"}`
</ParamField>

<ParamField body="public" type="boolean">
  Whether the sandbox HTTP preview is publicly accessible

  **Default:** `false`
</ParamField>

<ParamField body="networkBlockAll" type="boolean">
  Whether to block all network access for the sandbox

  **Default:** `false`
</ParamField>

<ParamField body="networkAllowList" type="string">
  Comma-separated list of allowed CIDR network addresses for the sandbox

  **Example:** `192.168.1.0/16,10.0.0.0/24`
</ParamField>

<ParamField body="class" type="string">
  The sandbox class type

  **Options:** `small`, `medium`, `large`
</ParamField>

<ParamField body="target" type="string">
  The target (region) where the sandbox will be created

  **Example:** `us`
</ParamField>

<ParamField body="cpu" type="integer">
  CPU cores allocated to the sandbox

  **Example:** `2`
</ParamField>

<ParamField body="gpu" type="integer">
  GPU units allocated to the sandbox

  **Example:** `1`
</ParamField>

<ParamField body="memory" type="integer">
  Memory allocated to the sandbox in GB

  **Example:** `4`
</ParamField>

<ParamField body="disk" type="integer">
  Disk space allocated to the sandbox in GB

  **Example:** `10`
</ParamField>

<ParamField body="autoStopInterval" type="integer">
  Auto-stop interval in minutes (0 means disabled)

  **Example:** `30`
</ParamField>

<ParamField body="autoArchiveInterval" type="integer">
  Auto-archive interval in minutes (0 means the maximum interval will be used)

  **Example:** `10080`
</ParamField>

<ParamField body="autoDeleteInterval" type="integer">
  Auto-delete interval in minutes (negative value means disabled, 0 means delete immediately upon stopping)

  **Example:** `30`
</ParamField>

<ParamField body="volumes" type="array">
  Array of volumes to attach to the sandbox
</ParamField>

<ParamField body="buildInfo" type="object">
  Build information for the sandbox
</ParamField>

## Response

<ResponseField name="id" type="string">
  The unique identifier of the sandbox
</ResponseField>

<ResponseField name="organizationId" type="string">
  The organization ID of the sandbox
</ResponseField>

<ResponseField name="name" type="string">
  The name of the sandbox
</ResponseField>

<ResponseField name="snapshot" type="string">
  The snapshot used for the sandbox
</ResponseField>

<ResponseField name="user" type="string">
  The user associated with the sandbox
</ResponseField>

<ResponseField name="env" type="object">
  Environment variables for the sandbox
</ResponseField>

<ResponseField name="labels" type="object">
  Labels for the sandbox
</ResponseField>

<ResponseField name="public" type="boolean">
  Whether the sandbox HTTP preview is public
</ResponseField>

<ResponseField name="target" type="string">
  The target environment for the sandbox
</ResponseField>

<ResponseField name="cpu" type="number">
  The CPU quota for the sandbox
</ResponseField>

<ResponseField name="gpu" type="number">
  The GPU quota for the sandbox
</ResponseField>

<ResponseField name="memory" type="number">
  The memory quota for the sandbox in GB
</ResponseField>

<ResponseField name="disk" type="number">
  The disk quota for the sandbox in GB
</ResponseField>

<ResponseField name="state" type="string">
  The current state of the sandbox

  **Options:** `creating`, `restoring`, `destroyed`, `destroying`, `started`, `stopped`, `starting`, `stopping`, `error`, `build_failed`, `pending_build`, `building_snapshot`, `unknown`, `pulling_snapshot`, `archived`, `archiving`, `resizing`
</ResponseField>

<ResponseField name="desiredState" type="string">
  The desired state of the sandbox
</ResponseField>

<ResponseField name="createdAt" type="string">
  The creation timestamp of the sandbox
</ResponseField>

<ResponseField name="updatedAt" type="string">
  The last update timestamp of the sandbox
</ResponseField>

<ResponseField name="runnerId" type="string">
  The runner ID of the sandbox
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.daytona.io/sandbox \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -H "X-Daytona-Organization-ID: your-org-id" \
    -d '{
      "name": "my-development-sandbox",
      "snapshot": "ubuntu-4vcpu-8ram-100gb",
      "user": "daytona",
      "cpu": 4,
      "memory": 8,
      "disk": 100,
      "env": {
        "NODE_ENV": "development"
      },
      "labels": {
        "project": "my-app",
        "environment": "dev"
      },
      "autoStopInterval": 60
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "id": "sandbox123",
    "organizationId": "org456",
    "name": "my-development-sandbox",
    "snapshot": "ubuntu-4vcpu-8ram-100gb",
    "user": "daytona",
    "env": {
      "NODE_ENV": "development"
    },
    "labels": {
      "project": "my-app",
      "environment": "dev"
    },
    "public": false,
    "networkBlockAll": false,
    "target": "us-east-1",
    "cpu": 4,
    "gpu": 0,
    "memory": 8,
    "disk": 100,
    "state": "creating",
    "desiredState": "started",
    "autoStopInterval": 60,
    "createdAt": "2024-10-01T12:00:00Z",
    "updatedAt": "2024-10-01T12:00:00Z",
    "runnerId": "runner789"
  }
  ```
</ResponseExample>
