> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.islo.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.islo.dev/_mcp/server.

# Create sandbox

POST https://ca.compute.islo.dev/sandboxes
Content-Type: application/json

Create a new sandbox VM with the requested resources.

Reference: https://docs.islo.dev/api-reference/sandboxes/create-sandbox

## Request

### Body (application/json)

This endpoint expects a CreateSandboxRequest.

- `cache_key` (string, optional, nullable)
- `disk_gb` (integer, optional)
- `env` (map from string to string, optional, nullable)
- `environment` (string, optional, nullable) — Environment for sandbox env and environment-owned gateway injection.
- `gateway_profile` (string, optional, nullable)
- `image` (string, optional)
- `init` (SandboxInit, optional, nullable) — Intent-based sandbox init selection.
- `internet_enabled` (boolean, optional)
- `lifecycle` (LifecyclePolicy, optional, nullable)
- `memory_mb` (integer, optional)
- `name` (string, optional, nullable)
- `request_id` (string, optional, nullable)
- `setup_scripts` (list of SetupScript, optional, nullable)
- `snapshot_name` (string, optional, nullable)
- `sources` (list of GitSource, optional, nullable)
- `vcpus` (integer, optional)
- `workdir` (string, optional, nullable)

## Response

### 201

Sandbox created

- `created_at` (string, required)
- `id` (string, required)
- `image` (string, required)
- `name` (string, required)
- `status` (string, required)
- `created_by` (string, optional, nullable)
- `creation_phase` (string, optional, nullable)
- `deleted_at` (string, optional, nullable)
- `lifecycle` (LifecyclePolicy, optional, nullable)
- `setup_steps` (list of SetupStepResult, optional, nullable)
- `spec` (SandboxSpec, optional, nullable)
- `workdir` (string, optional, nullable)

## Errors

### 400 Bad Request Error

Invalid request

- `code` (enum, required)
  - Allowed values: `AUTH_REQUIRED`, `INVALID_REQUEST`, `NOT_FOUND`, `VALIDATION_ERROR`, `SANDBOX_NOT_FOUND`, `SANDBOX_ALREADY_EXISTS`, `SANDBOX_INVALID_STATE`, `SANDBOX_PROVISIONING_FAILED`, `RESOURCE_NOT_FOUND`, `FILE_NOT_FOUND`, `COMMAND_NOT_FOUND`, `EXEC_FAILED`, `FILE_OPERATION_ERROR`, `RESOURCE_UNAVAILABLE`, `ACCESS_DENIED`, `CACHE_CONFLICT`, `BILLING_NOT_ALLOWED`, `TENANT_SUSPENDED`, `RATE_LIMITED`, `TIMEOUT`, `GONE`, `BAD_GATEWAY`, `INTERNAL_ERROR`
- `message` (string, required)
- `available` (long, optional, nullable)
- `limit` (long, optional, nullable)
- `request_id` (string, optional, nullable)
- `requested` (long, optional, nullable)
- `resource` (string, optional, nullable) — Optional capacity fields populated for `InsufficientResources` errors so clients (including peer agents) can recover the typed payload across HTTP boundaries instead of collapsing it to an opaque message.

### 401 Unauthorized Error

Unauthorized

- `code` (enum, required)
  - Allowed values: `AUTH_REQUIRED`, `INVALID_REQUEST`, `NOT_FOUND`, `VALIDATION_ERROR`, `SANDBOX_NOT_FOUND`, `SANDBOX_ALREADY_EXISTS`, `SANDBOX_INVALID_STATE`, `SANDBOX_PROVISIONING_FAILED`, `RESOURCE_NOT_FOUND`, `FILE_NOT_FOUND`, `COMMAND_NOT_FOUND`, `EXEC_FAILED`, `FILE_OPERATION_ERROR`, `RESOURCE_UNAVAILABLE`, `ACCESS_DENIED`, `CACHE_CONFLICT`, `BILLING_NOT_ALLOWED`, `TENANT_SUSPENDED`, `RATE_LIMITED`, `TIMEOUT`, `GONE`, `BAD_GATEWAY`, `INTERNAL_ERROR`
- `message` (string, required)
- `available` (long, optional, nullable)
- `limit` (long, optional, nullable)
- `request_id` (string, optional, nullable)
- `requested` (long, optional, nullable)
- `resource` (string, optional, nullable) — Optional capacity fields populated for `InsufficientResources` errors so clients (including peer agents) can recover the typed payload across HTTP boundaries instead of collapsing it to an opaque message.

### 409 Conflict Error

Conflict

- `code` (enum, required)
  - Allowed values: `AUTH_REQUIRED`, `INVALID_REQUEST`, `NOT_FOUND`, `VALIDATION_ERROR`, `SANDBOX_NOT_FOUND`, `SANDBOX_ALREADY_EXISTS`, `SANDBOX_INVALID_STATE`, `SANDBOX_PROVISIONING_FAILED`, `RESOURCE_NOT_FOUND`, `FILE_NOT_FOUND`, `COMMAND_NOT_FOUND`, `EXEC_FAILED`, `FILE_OPERATION_ERROR`, `RESOURCE_UNAVAILABLE`, `ACCESS_DENIED`, `CACHE_CONFLICT`, `BILLING_NOT_ALLOWED`, `TENANT_SUSPENDED`, `RATE_LIMITED`, `TIMEOUT`, `GONE`, `BAD_GATEWAY`, `INTERNAL_ERROR`
- `message` (string, required)
- `available` (long, optional, nullable)
- `limit` (long, optional, nullable)
- `request_id` (string, optional, nullable)
- `requested` (long, optional, nullable)
- `resource` (string, optional, nullable) — Optional capacity fields populated for `InsufficientResources` errors so clients (including peer agents) can recover the typed payload across HTTP boundaries instead of collapsing it to an opaque message.

### 503 Service Unavailable Error

Insufficient capacity

- `code` (enum, required)
  - Allowed values: `AUTH_REQUIRED`, `INVALID_REQUEST`, `NOT_FOUND`, `VALIDATION_ERROR`, `SANDBOX_NOT_FOUND`, `SANDBOX_ALREADY_EXISTS`, `SANDBOX_INVALID_STATE`, `SANDBOX_PROVISIONING_FAILED`, `RESOURCE_NOT_FOUND`, `FILE_NOT_FOUND`, `COMMAND_NOT_FOUND`, `EXEC_FAILED`, `FILE_OPERATION_ERROR`, `RESOURCE_UNAVAILABLE`, `ACCESS_DENIED`, `CACHE_CONFLICT`, `BILLING_NOT_ALLOWED`, `TENANT_SUSPENDED`, `RATE_LIMITED`, `TIMEOUT`, `GONE`, `BAD_GATEWAY`, `INTERNAL_ERROR`
- `message` (string, required)
- `available` (long, optional, nullable)
- `limit` (long, optional, nullable)
- `request_id` (string, optional, nullable)
- `requested` (long, optional, nullable)
- `resource` (string, optional, nullable) — Optional capacity fields populated for `InsufficientResources` errors so clients (including peer agents) can recover the typed payload across HTTP boundaries instead of collapsing it to an opaque message.

## Types

### SandboxInit

Intent-based sandbox init selection.

### LifecyclePolicy

- `auto_resume` (enum, optional)
  - Allowed values: `never`, `on_activity`
- `delete_after` (long, optional, nullable)
- `pause_after` (long, optional, nullable)
- `pause_after_idle` (long, optional, nullable)

### SetupScript

A named setup script to execute after git clones.

- `script` (string, required)
- `name` (string, optional)

### GitSource

A git source to clone into /workspace.

- `repo_url` (string, required)
- `branch` (string, optional, nullable)
- `target_path` (string, optional, nullable)

### SetupStepResult

- `name` (string, required)
- `status` (string, required)
- `stderr` (string, optional, nullable)
- `stdout` (string, optional, nullable)

### SandboxSpec

- `disk_gb` (integer, required)
- `memory_mb` (integer, required)
- `vcpus` (integer, required)

### SandboxInit0

- `type` (enum, required)
  - Allowed values: `minimal`

### SandboxInit1

- `type` (enum, required)
  - Allowed values: `full`

### SandboxInit2

- `capabilities` (list of enum, required)
  - Allowed values: `ssh`, `docker`
- `type` (enum, required)
  - Allowed values: `custom`
- `await_ready` (boolean, optional) — Block until capabilities are fully ready (e.g. sshd accepts connections, dockerd responds to API calls). Defaults to false.

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "created_at": "string",
  "id": "string",
  "image": "string",
  "name": "string",
  "status": "string",
  "created_by": "string",
  "creation_phase": "string",
  "deleted_at": "string",
  "lifecycle": null,
  "setup_steps": [
    {
      "name": "string",
      "status": "string",
      "stderr": "string",
      "stdout": "string"
    }
  ],
  "spec": null,
  "workdir": "string"
}
```

**SDK Code**

```python
import requests

url = "https://ca.compute.islo.dev/sandboxes"

payload = {}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://ca.compute.islo.dev/sandboxes';
const options = {method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{}'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://ca.compute.islo.dev/sandboxes"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://ca.compute.islo.dev/sandboxes")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://ca.compute.islo.dev/sandboxes")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://ca.compute.islo.dev/sandboxes', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://ca.compute.islo.dev/sandboxes");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://ca.compute.islo.dev/sandboxes")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```