Skip to main content
POST
/
sandbox
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
  }'
{
  "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"
}
Creates a new sandbox instance with the specified configuration including resources, environment variables, and network settings.

Headers

X-Daytona-Organization-ID
string
Use with JWT to specify the organization ID

Body Parameters

name
string
The name of the sandbox. If not provided, the sandbox ID will be used as the nameExample: MySandbox
snapshot
string
The ID or name of the snapshot used for the sandboxExample: ubuntu-4vcpu-8ram-100gb
user
string
The user associated with the sandboxExample: daytona
env
object
Environment variables for the sandbox as key-value pairsExample: {"NODE_ENV": "production"}
labels
object
Labels for the sandbox as key-value pairsExample: {"daytona.io/public": "true"}
public
boolean
Whether the sandbox HTTP preview is publicly accessibleDefault: false
networkBlockAll
boolean
Whether to block all network access for the sandboxDefault: false
networkAllowList
string
Comma-separated list of allowed CIDR network addresses for the sandboxExample: 192.168.1.0/16,10.0.0.0/24
class
string
The sandbox class typeOptions: small, medium, large
target
string
The target (region) where the sandbox will be createdExample: us
cpu
integer
CPU cores allocated to the sandboxExample: 2
gpu
integer
GPU units allocated to the sandboxExample: 1
memory
integer
Memory allocated to the sandbox in GBExample: 4
disk
integer
Disk space allocated to the sandbox in GBExample: 10
autoStopInterval
integer
Auto-stop interval in minutes (0 means disabled)Example: 30
autoArchiveInterval
integer
Auto-archive interval in minutes (0 means the maximum interval will be used)Example: 10080
autoDeleteInterval
integer
Auto-delete interval in minutes (negative value means disabled, 0 means delete immediately upon stopping)Example: 30
volumes
array
Array of volumes to attach to the sandbox
buildInfo
object
Build information for the sandbox

Response

id
string
The unique identifier of the sandbox
organizationId
string
The organization ID of the sandbox
name
string
The name of the sandbox
snapshot
string
The snapshot used for the sandbox
user
string
The user associated with the sandbox
env
object
Environment variables for the sandbox
labels
object
Labels for the sandbox
public
boolean
Whether the sandbox HTTP preview is public
target
string
The target environment for the sandbox
cpu
number
The CPU quota for the sandbox
gpu
number
The GPU quota for the sandbox
memory
number
The memory quota for the sandbox in GB
disk
number
The disk quota for the sandbox in GB
state
string
The current state of the sandboxOptions: creating, restoring, destroyed, destroying, started, stopped, starting, stopping, error, build_failed, pending_build, building_snapshot, unknown, pulling_snapshot, archived, archiving, resizing
desiredState
string
The desired state of the sandbox
createdAt
string
The creation timestamp of the sandbox
updatedAt
string
The last update timestamp of the sandbox
runnerId
string
The runner ID of the sandbox
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
  }'
{
  "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"
}

Build docs developers (and LLMs) love