# Sandbox VMs

## Create Agent Sandbox

**post** `/v1/sandbox_vms`

Create an Agent Sandbox to run sandboxes on. An Agent Sandbox can be paused and resumed, and is billed for compute only while it is running.

### Body Parameters

- `name: string`

  Name of the Agent Sandbox. Unique within its project.

- `project_id: string`

  ID of the project to create the Agent Sandbox in.

- `region: RegionName`

  Region the resource is in.

  - `"us-sva-2"`

  - `"us-wdc-1"`

- `instance_type: optional string`

  Instance type of the Agent Sandbox. Defaults to n1-highcpu-2 (2 vCPU, 4 GiB), the only size available.

- `tags: optional array of string`

  Tags to attach to the Agent Sandbox.

- `vpc_id: optional string`

  ID of the VPC to place the Agent Sandbox in. It must be a ready VPC in the Agent Sandbox's project and region.
  Omit it to use the project's oldest ready VPC in the region, or a new VPC when there is none.

### Returns

- `Operation object { id, created_at, details, 6 more }`

  Operation details.

  - `id: string`

    Unique identifier for the Operation.

  - `created_at: string`

    When the Operation was created.

  - `details: OperationDetails`

    Structured details about what an operation is changing.

    - `changes: OperationChanges`

      Map of changed field names to their from/to diffs. Keys depend on the parent operation's kind+type.

      - `from: string or number or boolean or array of string`

        Previous value.

        - `string`

        - `number`

        - `boolean`

        - `array of string`

      - `to: string or number or boolean or array of string`

        New value.

        - `string`

        - `number`

        - `boolean`

        - `array of string`

  - `kind: OperationKind`

    Kind of Operation.

    - `"vm"`

    - `"volume"`

    - `"vpc"`

    - `"firewall_rule"`

    - `"nks_cluster"`

    - `"nks_node_pool"`

    - `"sandbox_cluster"`

    - `"sandbox_vm"`

    - `"bucket"`

  - `project_id: string`

    Project ID the Operation belongs to.

  - `resource_id: string`

    ID of the resource that the Operation is acting on.

  - `status: OperationStatus`

    Status of the Operation.

    - `"pending"`

    - `"running"`

    - `"done"`

    - `"failed"`

    - `"unknown"`

  - `type: OperationType`

    Type of Operation.

    - `"create"`

    - `"update"`

    - `"delete"`

    - `"restart"`

    - `"pause"`

    - `"resume"`

  - `updated_at: string`

    When the Operation was updated.

### Example

```http
curl https://api.nirvanalabs.io/v1/sandbox_vms \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $NIRVANA_LABS_API_KEY" \
    -d '{
          "name": "my-sandboxes",
          "project_id": "123e4567-e89b-12d3-a456-426614174000",
          "region": "us-sva-2",
          "instance_type": "n1-highcpu-2",
          "tags": [
            "production",
            "agents"
          ],
          "vpc_id": "123e4567-e89b-12d3-a456-426614174000"
        }'
```

#### Response

```json
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "created_at": "2025-01-01T00:00:00Z",
  "details": {
    "changes": {
      "foo": {
        "from": "string",
        "to": "string"
      }
    }
  },
  "kind": "vm",
  "project_id": "123e4567-e89b-12d3-a456-426614174000",
  "resource_id": "123e4567-e89b-12d3-a456-426614174000",
  "status": "pending",
  "type": "create",
  "updated_at": "2025-01-01T00:00:00Z"
}
```

## Get Agent Sandbox

**get** `/v1/sandbox_vms/{sandbox_vm_id}`

Get an Agent Sandbox

### Path Parameters

- `sandbox_vm_id: string`

### Returns

- `SandboxVM object { id, created_at, endpoint_hostname, 13 more }`

  An Agent Sandbox: a VM sandboxes run on, in one region. It can be paused and resumed.

  - `id: string`

    Unique identifier for the Agent Sandbox.

  - `created_at: string`

    When the Agent Sandbox was created.

  - `endpoint_hostname: string`

    Hostname the Agent Sandbox's sandbox API is served on over HTTPS. It stays the same for the life of the Agent Sandbox. Null until assigned.

  - `image_version: string`

    Version of the image the Agent Sandbox runs. Null until it is running.

  - `instance_type: string`

    Instance type of the Agent Sandbox.

  - `name: string`

    Name of the Agent Sandbox.

  - `opensandbox_version: string`

    Version of OpenSandbox the Agent Sandbox runs. Null until it is running.

  - `paused_at: string`

    When the Agent Sandbox was paused. Null while it is running.

  - `power_state: "running" or "paused" or "powered_off"`

    Whether the Agent Sandbox's sandboxes can run.

    - `"running"`

    - `"paused"`

    - `"powered_off"`

  - `powers_off_at: string`

    When the paused Agent Sandbox is, or was, powered off. Null while it is running.

  - `project_id: string`

    ID of the project the Agent Sandbox is in.

  - `region: RegionName`

    Region the resource is in.

    - `"us-sva-2"`

    - `"us-wdc-1"`

  - `status: ResourceStatus`

    Status of the resource.

    - `"pending"`

    - `"creating"`

    - `"updating"`

    - `"ready"`

    - `"deleting"`

    - `"deleted"`

    - `"error"`

    - `"suspended"`

  - `tags: array of string`

    Tags attached to the Agent Sandbox.

  - `updated_at: string`

    When the Agent Sandbox was last updated.

  - `vpc_id: string`

    ID of the VPC the Agent Sandbox is in. Null until it is placed in one.

### Example

```http
curl https://api.nirvanalabs.io/v1/sandbox_vms/$SANDBOX_VM_ID \
    -H "Authorization: Bearer $NIRVANA_LABS_API_KEY"
```

#### Response

```json
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "created_at": "2025-01-01T00:00:00Z",
  "endpoint_hostname": "0123456789ab.sandboxes.example.com",
  "image_version": "2026.11.1",
  "instance_type": "n1-highcpu-2",
  "name": "my-sandboxes",
  "opensandbox_version": "1.2.0",
  "paused_at": "2025-01-01T00:00:00Z",
  "power_state": "running",
  "powers_off_at": "2025-01-01T01:00:00Z",
  "project_id": "123e4567-e89b-12d3-a456-426614174000",
  "region": "us-sva-2",
  "status": "ready",
  "tags": [
    "production",
    "agents"
  ],
  "updated_at": "2025-01-01T00:00:00Z",
  "vpc_id": "123e4567-e89b-12d3-a456-426614174000"
}
```

## Update Agent Sandbox

**patch** `/v1/sandbox_vms/{sandbox_vm_id}`

Update an Agent Sandbox's name and tags

### Path Parameters

- `sandbox_vm_id: string`

### Body Parameters

- `name: optional string`

  Name of the Agent Sandbox. Unique within its project.

- `tags: optional array of string`

  Tags to attach to the Agent Sandbox.

### Returns

- `SandboxVM object { id, created_at, endpoint_hostname, 13 more }`

  An Agent Sandbox: a VM sandboxes run on, in one region. It can be paused and resumed.

  - `id: string`

    Unique identifier for the Agent Sandbox.

  - `created_at: string`

    When the Agent Sandbox was created.

  - `endpoint_hostname: string`

    Hostname the Agent Sandbox's sandbox API is served on over HTTPS. It stays the same for the life of the Agent Sandbox. Null until assigned.

  - `image_version: string`

    Version of the image the Agent Sandbox runs. Null until it is running.

  - `instance_type: string`

    Instance type of the Agent Sandbox.

  - `name: string`

    Name of the Agent Sandbox.

  - `opensandbox_version: string`

    Version of OpenSandbox the Agent Sandbox runs. Null until it is running.

  - `paused_at: string`

    When the Agent Sandbox was paused. Null while it is running.

  - `power_state: "running" or "paused" or "powered_off"`

    Whether the Agent Sandbox's sandboxes can run.

    - `"running"`

    - `"paused"`

    - `"powered_off"`

  - `powers_off_at: string`

    When the paused Agent Sandbox is, or was, powered off. Null while it is running.

  - `project_id: string`

    ID of the project the Agent Sandbox is in.

  - `region: RegionName`

    Region the resource is in.

    - `"us-sva-2"`

    - `"us-wdc-1"`

  - `status: ResourceStatus`

    Status of the resource.

    - `"pending"`

    - `"creating"`

    - `"updating"`

    - `"ready"`

    - `"deleting"`

    - `"deleted"`

    - `"error"`

    - `"suspended"`

  - `tags: array of string`

    Tags attached to the Agent Sandbox.

  - `updated_at: string`

    When the Agent Sandbox was last updated.

  - `vpc_id: string`

    ID of the VPC the Agent Sandbox is in. Null until it is placed in one.

### Example

```http
curl https://api.nirvanalabs.io/v1/sandbox_vms/$SANDBOX_VM_ID \
    -X PATCH \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $NIRVANA_LABS_API_KEY" \
    -d '{
          "name": "my-sandboxes",
          "tags": [
            "production",
            "agents"
          ]
        }'
```

#### Response

```json
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "created_at": "2025-01-01T00:00:00Z",
  "endpoint_hostname": "0123456789ab.sandboxes.example.com",
  "image_version": "2026.11.1",
  "instance_type": "n1-highcpu-2",
  "name": "my-sandboxes",
  "opensandbox_version": "1.2.0",
  "paused_at": "2025-01-01T00:00:00Z",
  "power_state": "running",
  "powers_off_at": "2025-01-01T01:00:00Z",
  "project_id": "123e4567-e89b-12d3-a456-426614174000",
  "region": "us-sva-2",
  "status": "ready",
  "tags": [
    "production",
    "agents"
  ],
  "updated_at": "2025-01-01T00:00:00Z",
  "vpc_id": "123e4567-e89b-12d3-a456-426614174000"
}
```

## Delete Agent Sandbox

**delete** `/v1/sandbox_vms/{sandbox_vm_id}`

Delete an Agent Sandbox, with its sandboxes and its disk. An Agent Sandbox can be deleted when it is ready or failed, whether it is running, paused or powered off.

### Path Parameters

- `sandbox_vm_id: string`

### Returns

- `Operation object { id, created_at, details, 6 more }`

  Operation details.

  - `id: string`

    Unique identifier for the Operation.

  - `created_at: string`

    When the Operation was created.

  - `details: OperationDetails`

    Structured details about what an operation is changing.

    - `changes: OperationChanges`

      Map of changed field names to their from/to diffs. Keys depend on the parent operation's kind+type.

      - `from: string or number or boolean or array of string`

        Previous value.

        - `string`

        - `number`

        - `boolean`

        - `array of string`

      - `to: string or number or boolean or array of string`

        New value.

        - `string`

        - `number`

        - `boolean`

        - `array of string`

  - `kind: OperationKind`

    Kind of Operation.

    - `"vm"`

    - `"volume"`

    - `"vpc"`

    - `"firewall_rule"`

    - `"nks_cluster"`

    - `"nks_node_pool"`

    - `"sandbox_cluster"`

    - `"sandbox_vm"`

    - `"bucket"`

  - `project_id: string`

    Project ID the Operation belongs to.

  - `resource_id: string`

    ID of the resource that the Operation is acting on.

  - `status: OperationStatus`

    Status of the Operation.

    - `"pending"`

    - `"running"`

    - `"done"`

    - `"failed"`

    - `"unknown"`

  - `type: OperationType`

    Type of Operation.

    - `"create"`

    - `"update"`

    - `"delete"`

    - `"restart"`

    - `"pause"`

    - `"resume"`

  - `updated_at: string`

    When the Operation was updated.

### Example

```http
curl https://api.nirvanalabs.io/v1/sandbox_vms/$SANDBOX_VM_ID \
    -X DELETE \
    -H "Authorization: Bearer $NIRVANA_LABS_API_KEY"
```

#### Response

```json
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "created_at": "2025-01-01T00:00:00Z",
  "details": {
    "changes": {
      "foo": {
        "from": "string",
        "to": "string"
      }
    }
  },
  "kind": "vm",
  "project_id": "123e4567-e89b-12d3-a456-426614174000",
  "resource_id": "123e4567-e89b-12d3-a456-426614174000",
  "status": "pending",
  "type": "create",
  "updated_at": "2025-01-01T00:00:00Z"
}
```

## List Agent Sandboxes

**get** `/v1/sandbox_vms`

List the Agent Sandboxes in a project

### Query Parameters

- `project_id: string`

  Project ID of resources to request

- `cursor: optional string`

  Pagination cursor returned by a previous request. Only valid for the same sort order.

- `limit: optional number`

  Maximum number of items to return

- `name: optional string`

  Filter by a case-insensitive substring of the Agent Sandbox name

- `region: optional string`

  Filter by region

- `sort: optional string`

  Comma-separated sort terms in precedence order, each field:asc or field:desc. Fields: created_at, updated_at

- `tags: optional array of string`

  Filter by tags. Repeat the parameter to require several tags; an Agent Sandbox must carry all of them.

### Returns

- `SandboxVMList object { items, pagination }`

  - `items: array of SandboxVM`

    - `id: string`

      Unique identifier for the Agent Sandbox.

    - `created_at: string`

      When the Agent Sandbox was created.

    - `endpoint_hostname: string`

      Hostname the Agent Sandbox's sandbox API is served on over HTTPS. It stays the same for the life of the Agent Sandbox. Null until assigned.

    - `image_version: string`

      Version of the image the Agent Sandbox runs. Null until it is running.

    - `instance_type: string`

      Instance type of the Agent Sandbox.

    - `name: string`

      Name of the Agent Sandbox.

    - `opensandbox_version: string`

      Version of OpenSandbox the Agent Sandbox runs. Null until it is running.

    - `paused_at: string`

      When the Agent Sandbox was paused. Null while it is running.

    - `power_state: "running" or "paused" or "powered_off"`

      Whether the Agent Sandbox's sandboxes can run.

      - `"running"`

      - `"paused"`

      - `"powered_off"`

    - `powers_off_at: string`

      When the paused Agent Sandbox is, or was, powered off. Null while it is running.

    - `project_id: string`

      ID of the project the Agent Sandbox is in.

    - `region: RegionName`

      Region the resource is in.

      - `"us-sva-2"`

      - `"us-wdc-1"`

    - `status: ResourceStatus`

      Status of the resource.

      - `"pending"`

      - `"creating"`

      - `"updating"`

      - `"ready"`

      - `"deleting"`

      - `"deleted"`

      - `"error"`

      - `"suspended"`

    - `tags: array of string`

      Tags attached to the Agent Sandbox.

    - `updated_at: string`

      When the Agent Sandbox was last updated.

    - `vpc_id: string`

      ID of the VPC the Agent Sandbox is in. Null until it is placed in one.

  - `pagination: Pagination`

    Pagination response details.

    - `next_cursor: string`

    - `previous_cursor: string`

    - `total_count: number`

### Example

```http
curl https://api.nirvanalabs.io/v1/sandbox_vms \
    -H "Authorization: Bearer $NIRVANA_LABS_API_KEY"
```

#### Response

```json
{
  "items": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "created_at": "2025-01-01T00:00:00Z",
      "endpoint_hostname": "0123456789ab.sandboxes.example.com",
      "image_version": "2026.11.1",
      "instance_type": "n1-highcpu-2",
      "name": "my-sandboxes",
      "opensandbox_version": "1.2.0",
      "paused_at": "2025-01-01T00:00:00Z",
      "power_state": "running",
      "powers_off_at": "2025-01-01T01:00:00Z",
      "project_id": "123e4567-e89b-12d3-a456-426614174000",
      "region": "us-sva-2",
      "status": "ready",
      "tags": [
        "production",
        "agents"
      ],
      "updated_at": "2025-01-01T00:00:00Z",
      "vpc_id": "123e4567-e89b-12d3-a456-426614174000"
    }
  ],
  "pagination": {
    "next_cursor": "RhwniMT4B74siYZcPF8TnCdGI1l9rpPvg",
    "previous_cursor": "ARhwnmi1hA7wEbHbMjdYQlOB_ZusP4fYvw",
    "total_count": 125
  }
}
```

## Pause Agent Sandbox

**post** `/v1/sandbox_vms/{sandbox_vm_id}/pause`

Pause an Agent Sandbox. Its sandboxes stop, keeping their files and installed packages but not their
running processes or memory, and compute billing stops. After an hour paused the Agent Sandbox is
powered off. A pause sent while another change runs waits for it, and pausing a paused Agent Sandbox
changes nothing.

### Path Parameters

- `sandbox_vm_id: string`

### Returns

- `Operation object { id, created_at, details, 6 more }`

  Operation details.

  - `id: string`

    Unique identifier for the Operation.

  - `created_at: string`

    When the Operation was created.

  - `details: OperationDetails`

    Structured details about what an operation is changing.

    - `changes: OperationChanges`

      Map of changed field names to their from/to diffs. Keys depend on the parent operation's kind+type.

      - `from: string or number or boolean or array of string`

        Previous value.

        - `string`

        - `number`

        - `boolean`

        - `array of string`

      - `to: string or number or boolean or array of string`

        New value.

        - `string`

        - `number`

        - `boolean`

        - `array of string`

  - `kind: OperationKind`

    Kind of Operation.

    - `"vm"`

    - `"volume"`

    - `"vpc"`

    - `"firewall_rule"`

    - `"nks_cluster"`

    - `"nks_node_pool"`

    - `"sandbox_cluster"`

    - `"sandbox_vm"`

    - `"bucket"`

  - `project_id: string`

    Project ID the Operation belongs to.

  - `resource_id: string`

    ID of the resource that the Operation is acting on.

  - `status: OperationStatus`

    Status of the Operation.

    - `"pending"`

    - `"running"`

    - `"done"`

    - `"failed"`

    - `"unknown"`

  - `type: OperationType`

    Type of Operation.

    - `"create"`

    - `"update"`

    - `"delete"`

    - `"restart"`

    - `"pause"`

    - `"resume"`

  - `updated_at: string`

    When the Operation was updated.

### Example

```http
curl https://api.nirvanalabs.io/v1/sandbox_vms/$SANDBOX_VM_ID/pause \
    -X POST \
    -H "Authorization: Bearer $NIRVANA_LABS_API_KEY"
```

#### Response

```json
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "created_at": "2025-01-01T00:00:00Z",
  "details": {
    "changes": {
      "foo": {
        "from": "string",
        "to": "string"
      }
    }
  },
  "kind": "vm",
  "project_id": "123e4567-e89b-12d3-a456-426614174000",
  "resource_id": "123e4567-e89b-12d3-a456-426614174000",
  "status": "pending",
  "type": "create",
  "updated_at": "2025-01-01T00:00:00Z"
}
```

## Resume Agent Sandbox

**post** `/v1/sandbox_vms/{sandbox_vm_id}/resume`

Resume a paused or powered-off Agent Sandbox, restarting its sandboxes. A resume sent while another
change runs waits for it, and resuming a running Agent Sandbox changes nothing. Pausing doesn't free
quota and resuming doesn't use any: a paused Agent Sandbox still counts toward the sandbox quota's vms,
and Agent Sandboxes don't count toward its vcpu or memory_gb. A billing block returns 402.

### Path Parameters

- `sandbox_vm_id: string`

### Returns

- `Operation object { id, created_at, details, 6 more }`

  Operation details.

  - `id: string`

    Unique identifier for the Operation.

  - `created_at: string`

    When the Operation was created.

  - `details: OperationDetails`

    Structured details about what an operation is changing.

    - `changes: OperationChanges`

      Map of changed field names to their from/to diffs. Keys depend on the parent operation's kind+type.

      - `from: string or number or boolean or array of string`

        Previous value.

        - `string`

        - `number`

        - `boolean`

        - `array of string`

      - `to: string or number or boolean or array of string`

        New value.

        - `string`

        - `number`

        - `boolean`

        - `array of string`

  - `kind: OperationKind`

    Kind of Operation.

    - `"vm"`

    - `"volume"`

    - `"vpc"`

    - `"firewall_rule"`

    - `"nks_cluster"`

    - `"nks_node_pool"`

    - `"sandbox_cluster"`

    - `"sandbox_vm"`

    - `"bucket"`

  - `project_id: string`

    Project ID the Operation belongs to.

  - `resource_id: string`

    ID of the resource that the Operation is acting on.

  - `status: OperationStatus`

    Status of the Operation.

    - `"pending"`

    - `"running"`

    - `"done"`

    - `"failed"`

    - `"unknown"`

  - `type: OperationType`

    Type of Operation.

    - `"create"`

    - `"update"`

    - `"delete"`

    - `"restart"`

    - `"pause"`

    - `"resume"`

  - `updated_at: string`

    When the Operation was updated.

### Example

```http
curl https://api.nirvanalabs.io/v1/sandbox_vms/$SANDBOX_VM_ID/resume \
    -X POST \
    -H "Authorization: Bearer $NIRVANA_LABS_API_KEY"
```

#### Response

```json
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "created_at": "2025-01-01T00:00:00Z",
  "details": {
    "changes": {
      "foo": {
        "from": "string",
        "to": "string"
      }
    }
  },
  "kind": "vm",
  "project_id": "123e4567-e89b-12d3-a456-426614174000",
  "resource_id": "123e4567-e89b-12d3-a456-426614174000",
  "status": "pending",
  "type": "create",
  "updated_at": "2025-01-01T00:00:00Z"
}
```

## Restart Agent Sandbox

**post** `/v1/sandbox_vms/{sandbox_vm_id}/restart`

Restart an Agent Sandbox's VM. Its sandboxes keep their files and installed packages but not their running
processes or memory. A restart sent while another change runs waits for it.
A billing block returns 402.

### Path Parameters

- `sandbox_vm_id: string`

### Returns

- `Operation object { id, created_at, details, 6 more }`

  Operation details.

  - `id: string`

    Unique identifier for the Operation.

  - `created_at: string`

    When the Operation was created.

  - `details: OperationDetails`

    Structured details about what an operation is changing.

    - `changes: OperationChanges`

      Map of changed field names to their from/to diffs. Keys depend on the parent operation's kind+type.

      - `from: string or number or boolean or array of string`

        Previous value.

        - `string`

        - `number`

        - `boolean`

        - `array of string`

      - `to: string or number or boolean or array of string`

        New value.

        - `string`

        - `number`

        - `boolean`

        - `array of string`

  - `kind: OperationKind`

    Kind of Operation.

    - `"vm"`

    - `"volume"`

    - `"vpc"`

    - `"firewall_rule"`

    - `"nks_cluster"`

    - `"nks_node_pool"`

    - `"sandbox_cluster"`

    - `"sandbox_vm"`

    - `"bucket"`

  - `project_id: string`

    Project ID the Operation belongs to.

  - `resource_id: string`

    ID of the resource that the Operation is acting on.

  - `status: OperationStatus`

    Status of the Operation.

    - `"pending"`

    - `"running"`

    - `"done"`

    - `"failed"`

    - `"unknown"`

  - `type: OperationType`

    Type of Operation.

    - `"create"`

    - `"update"`

    - `"delete"`

    - `"restart"`

    - `"pause"`

    - `"resume"`

  - `updated_at: string`

    When the Operation was updated.

### Example

```http
curl https://api.nirvanalabs.io/v1/sandbox_vms/$SANDBOX_VM_ID/restart \
    -X POST \
    -H "Authorization: Bearer $NIRVANA_LABS_API_KEY"
```

#### Response

```json
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "created_at": "2025-01-01T00:00:00Z",
  "details": {
    "changes": {
      "foo": {
        "from": "string",
        "to": "string"
      }
    }
  },
  "kind": "vm",
  "project_id": "123e4567-e89b-12d3-a456-426614174000",
  "resource_id": "123e4567-e89b-12d3-a456-426614174000",
  "status": "pending",
  "type": "create",
  "updated_at": "2025-01-01T00:00:00Z"
}
```

## Domain Types

### Sandbox VM

- `SandboxVM object { id, created_at, endpoint_hostname, 13 more }`

  An Agent Sandbox: a VM sandboxes run on, in one region. It can be paused and resumed.

  - `id: string`

    Unique identifier for the Agent Sandbox.

  - `created_at: string`

    When the Agent Sandbox was created.

  - `endpoint_hostname: string`

    Hostname the Agent Sandbox's sandbox API is served on over HTTPS. It stays the same for the life of the Agent Sandbox. Null until assigned.

  - `image_version: string`

    Version of the image the Agent Sandbox runs. Null until it is running.

  - `instance_type: string`

    Instance type of the Agent Sandbox.

  - `name: string`

    Name of the Agent Sandbox.

  - `opensandbox_version: string`

    Version of OpenSandbox the Agent Sandbox runs. Null until it is running.

  - `paused_at: string`

    When the Agent Sandbox was paused. Null while it is running.

  - `power_state: "running" or "paused" or "powered_off"`

    Whether the Agent Sandbox's sandboxes can run.

    - `"running"`

    - `"paused"`

    - `"powered_off"`

  - `powers_off_at: string`

    When the paused Agent Sandbox is, or was, powered off. Null while it is running.

  - `project_id: string`

    ID of the project the Agent Sandbox is in.

  - `region: RegionName`

    Region the resource is in.

    - `"us-sva-2"`

    - `"us-wdc-1"`

  - `status: ResourceStatus`

    Status of the resource.

    - `"pending"`

    - `"creating"`

    - `"updating"`

    - `"ready"`

    - `"deleting"`

    - `"deleted"`

    - `"error"`

    - `"suspended"`

  - `tags: array of string`

    Tags attached to the Agent Sandbox.

  - `updated_at: string`

    When the Agent Sandbox was last updated.

  - `vpc_id: string`

    ID of the VPC the Agent Sandbox is in. Null until it is placed in one.

### Sandbox VM List

- `SandboxVMList object { items, pagination }`

  - `items: array of SandboxVM`

    - `id: string`

      Unique identifier for the Agent Sandbox.

    - `created_at: string`

      When the Agent Sandbox was created.

    - `endpoint_hostname: string`

      Hostname the Agent Sandbox's sandbox API is served on over HTTPS. It stays the same for the life of the Agent Sandbox. Null until assigned.

    - `image_version: string`

      Version of the image the Agent Sandbox runs. Null until it is running.

    - `instance_type: string`

      Instance type of the Agent Sandbox.

    - `name: string`

      Name of the Agent Sandbox.

    - `opensandbox_version: string`

      Version of OpenSandbox the Agent Sandbox runs. Null until it is running.

    - `paused_at: string`

      When the Agent Sandbox was paused. Null while it is running.

    - `power_state: "running" or "paused" or "powered_off"`

      Whether the Agent Sandbox's sandboxes can run.

      - `"running"`

      - `"paused"`

      - `"powered_off"`

    - `powers_off_at: string`

      When the paused Agent Sandbox is, or was, powered off. Null while it is running.

    - `project_id: string`

      ID of the project the Agent Sandbox is in.

    - `region: RegionName`

      Region the resource is in.

      - `"us-sva-2"`

      - `"us-wdc-1"`

    - `status: ResourceStatus`

      Status of the resource.

      - `"pending"`

      - `"creating"`

      - `"updating"`

      - `"ready"`

      - `"deleting"`

      - `"deleted"`

      - `"error"`

      - `"suspended"`

    - `tags: array of string`

      Tags attached to the Agent Sandbox.

    - `updated_at: string`

      When the Agent Sandbox was last updated.

    - `vpc_id: string`

      ID of the VPC the Agent Sandbox is in. Null until it is placed in one.

  - `pagination: Pagination`

    Pagination response details.

    - `next_cursor: string`

    - `previous_cursor: string`

    - `total_count: number`

# Cost

## Estimate Agent Sandbox Create Cost

**post** `/v1/sandbox_vms/cost`

Return a priced cost quote for the proposed Agent Sandbox while it runs. A paused or powered-off Agent Sandbox is billed for its disk only.

### Body Parameters

- `name: string`

  Name of the Agent Sandbox. Unique within its project.

- `project_id: string`

  ID of the project to create the Agent Sandbox in.

- `region: RegionName`

  Region the resource is in.

  - `"us-sva-2"`

  - `"us-wdc-1"`

- `instance_type: optional string`

  Instance type of the Agent Sandbox. Defaults to n1-highcpu-2 (2 vCPU, 4 GiB), the only size available.

- `tags: optional array of string`

  Tags to attach to the Agent Sandbox.

- `vpc_id: optional string`

  ID of the VPC to place the Agent Sandbox in. It must be a ready VPC in the Agent Sandbox's project and region.
  Omit it to use the project's oldest ready VPC in the region, or a new VPC when there is none.

### Returns

- `CostQuote object { currency, monthly_total, priced_at, 3 more }`

  Cost quote returned by POST /cost. current_summary and updated_summary hold the org billing summary now and with this resource; omitted when the caller cannot view billing.

  - `currency: string`

    Currency the quote is denominated in. Always "USD" in v1.

  - `monthly_total: string`

    Arbitrary-precision decimal serialized as a string (e.g. "58.40").

  - `priced_at: string`

    Timestamp the quote was priced at.

  - `usage_dimensions: array of object { dimension, dimension_display_name, monthly_amount, 2 more }`

    Priced rows, one per usage dimension emitted by the resource.

    - `dimension: string`

      Usage dimension being priced (e.g. compute_vcpu, storage_abs_gb).

    - `dimension_display_name: string`

      User-facing label for the dimension (e.g. "vCPU (hours)").

    - `monthly_amount: string`

      Arbitrary-precision decimal serialized as a string (e.g. "58.40").

    - `quantity: number`

      Quantity of the dimension being priced.

    - `unit_price: string`

      Arbitrary-precision decimal serialized as a string (e.g. "58.40").

  - `current_summary: optional OrganizationBillingSummary`

    Forward-looking billing summary for an organization. All costs are run-rate projections from the organization's current active usage ("≈ $X/mo at current usage").

    - `daily_cost: string`

      Arbitrary-precision decimal serialized as a string (e.g. "58.40").

    - `effective_balance: string`

      Arbitrary-precision decimal serialized as a string (e.g. "58.40").

    - `monthly_cost: string`

      Arbitrary-precision decimal serialized as a string (e.g. "58.40").

    - `promotional_credits: array of object { amount, kind, status }`

      Credits the organization earns automatically through the startup credits program, one per step. Empty when the organization is not part of the program.

      - `amount: string`

        Arbitrary-precision decimal serialized as a string (e.g. "58.40").

      - `kind: "organization_created" or "payment_method_added"`

        Step that earns the credit: creating the organization, or saving a payment method on it.

        - `"organization_created"`

        - `"payment_method_added"`

      - `status: "available" or "pending" or "granted"`

        Whether the credit can still be earned ("available"), was earned and is being issued ("pending"), or was issued ("granted"). A granted credit reaches the balance shortly after it is issued.

        - `"available"`

        - `"pending"`

        - `"granted"`

    - `recharge_threshold_days: string`

      Arbitrary-precision decimal serialized as a string (e.g. "58.40").

    - `estimated_next_charge_at: optional string`

      Projected date the balance reaches the recharge threshold at the current run-rate. Null when there is no active usage (never charges).

    - `runway_months: optional string`

      Arbitrary-precision decimal serialized as a string (e.g. "58.40").

  - `updated_summary: optional OrganizationBillingSummary`

    Forward-looking billing summary for an organization. All costs are run-rate projections from the organization's current active usage ("≈ $X/mo at current usage").

### Example

```http
curl https://api.nirvanalabs.io/v1/sandbox_vms/cost \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $NIRVANA_LABS_API_KEY" \
    -d '{
          "name": "my-sandboxes",
          "project_id": "123e4567-e89b-12d3-a456-426614174000",
          "region": "us-sva-2",
          "instance_type": "n1-highcpu-2",
          "tags": [
            "production",
            "agents"
          ],
          "vpc_id": "123e4567-e89b-12d3-a456-426614174000"
        }'
```

#### Response

```json
{
  "currency": "USD",
  "monthly_total": "-69125",
  "priced_at": "2025-01-01T00:00:00Z",
  "usage_dimensions": [
    {
      "dimension": "compute_vcpu",
      "dimension_display_name": "vCPU (hours)",
      "monthly_amount": "-69125",
      "quantity": 4,
      "unit_price": "-69125"
    }
  ],
  "current_summary": {
    "daily_cost": "-69125",
    "effective_balance": "-69125",
    "monthly_cost": "-69125",
    "promotional_credits": [
      {
        "amount": "-69125",
        "kind": "payment_method_added",
        "status": "available"
      }
    ],
    "recharge_threshold_days": "-69125",
    "estimated_next_charge_at": "2025-01-01T00:00:00Z",
    "runway_months": "-69125"
  },
  "updated_summary": {
    "daily_cost": "-69125",
    "effective_balance": "-69125",
    "monthly_cost": "-69125",
    "promotional_credits": [
      {
        "amount": "-69125",
        "kind": "payment_method_added",
        "status": "available"
      }
    ],
    "recharge_threshold_days": "-69125",
    "estimated_next_charge_at": "2025-01-01T00:00:00Z",
    "runway_months": "-69125"
  }
}
```
