# Volumes

## Create Volume

**post** `/v1/compute/volumes`

Create a Volume. Only data volumes can be created.

### Body Parameters

- `name: string`

  Name of the Volume.

- `project_id: string`

  Project ID the Volume belongs to.

- `region: RegionName`

  Region the resource is in.

  - `"us-sva-2"`

- `size: number`

  Size of the Volume in GB.

- `type: VolumeType`

  Type of the Volume.

  - `"nvme"`

  - `"abs"`

- `tags: optional array of string`

  Tags to attach to the Volume.

- `vm_id: optional string`

  ID of the VM the Volume is attached to.

### 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"`

  - `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"`

  - `updated_at: string`

    When the Operation was updated.

### Example

```http
curl https://api.nirvanalabs.io/v1/compute/volumes \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $NIRVANA_LABS_API_KEY" \
    -d '{
          "name": "my-data-volume",
          "project_id": "123e4567-e89b-12d3-a456-426614174000",
          "region": "us-sva-2",
          "size": 100,
          "type": "abs",
          "tags": [
            "production",
            "ethereum"
          ],
          "vm_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 Volume

**get** `/v1/compute/volumes/{volume_id}`

Get a Volume.

### Path Parameters

- `volume_id: string`

### Returns

- `Volume object { id, created_at, kind, 10 more }`

  Volume details.

  - `id: string`

    Unique identifier for the Volume.

  - `created_at: string`

    When the Volume was created.

  - `kind: VolumeKind`

    Volume kind.

    - `"boot"`

    - `"data"`

  - `name: string`

    Name of the Volume.

  - `project_id: string`

    Project ID the Volume belongs to.

  - `region: RegionName`

    Region the resource is in.

    - `"us-sva-2"`

  - `size: number`

    Size of the Volume in GB.

  - `status: ResourceStatus`

    Status of the resource.

    - `"pending"`

    - `"creating"`

    - `"updating"`

    - `"ready"`

    - `"deleting"`

    - `"deleted"`

    - `"error"`

  - `tags: array of string`

    Tags to attach to the Volume.

  - `type: VolumeType`

    Type of the Volume.

    - `"nvme"`

    - `"abs"`

  - `updated_at: string`

    When the Volume was updated.

  - `vm_id: string`

    ID of the VM the Volume is attached to.

  - `vm_name: string`

    Name of the VM the Volume is attached to.

### Example

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

#### Response

```json
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "created_at": "2025-01-01T00:00:00Z",
  "kind": "boot",
  "name": "my-volume",
  "project_id": "123e4567-e89b-12d3-a456-426614174000",
  "region": "us-sva-2",
  "size": 100,
  "status": "ready",
  "tags": [
    "production",
    "ethereum"
  ],
  "type": "abs",
  "updated_at": "2025-01-01T00:00:00Z",
  "vm_id": "123e4567-e89b-12d3-a456-426614174000",
  "vm_name": "my-vm"
}
```

## Update Volume

**patch** `/v1/compute/volumes/{volume_id}`

Update a Volume. Boot or data volumes can be updated.

### Path Parameters

- `volume_id: string`

### Body Parameters

- `name: optional string`

  Name of the Volume.

- `size: optional number`

  Size of the Volume in GB.

- `tags: optional array of string`

  Tags to attach to the Volume.

### 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"`

  - `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"`

  - `updated_at: string`

    When the Operation was updated.

### Example

```http
curl https://api.nirvanalabs.io/v1/compute/volumes/$VOLUME_ID \
    -X PATCH \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $NIRVANA_LABS_API_KEY" \
    -d '{
          "name": "my-data-volume",
          "size": 100,
          "tags": [
            "production",
            "ethereum"
          ]
        }'
```

#### 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"
}
```

## Delete Volume

**delete** `/v1/compute/volumes/{volume_id}`

Delete a Volume. Boot or data volumes can be deleted.

### Path Parameters

- `volume_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"`

  - `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"`

  - `updated_at: string`

    When the Operation was updated.

### Example

```http
curl https://api.nirvanalabs.io/v1/compute/volumes/$VOLUME_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 Volumes

**get** `/v1/compute/volumes`

List all volumes

### Query Parameters

- `project_id: string`

  Project ID of resources to request

- `cursor: optional string`

  Pagination cursor returned by a previous request

- `limit: optional number`

  Maximum number of items to return

### Returns

- `VolumeList object { items, pagination }`

  - `items: array of Volume`

    - `id: string`

      Unique identifier for the Volume.

    - `created_at: string`

      When the Volume was created.

    - `kind: VolumeKind`

      Volume kind.

      - `"boot"`

      - `"data"`

    - `name: string`

      Name of the Volume.

    - `project_id: string`

      Project ID the Volume belongs to.

    - `region: RegionName`

      Region the resource is in.

      - `"us-sva-2"`

    - `size: number`

      Size of the Volume in GB.

    - `status: ResourceStatus`

      Status of the resource.

      - `"pending"`

      - `"creating"`

      - `"updating"`

      - `"ready"`

      - `"deleting"`

      - `"deleted"`

      - `"error"`

    - `tags: array of string`

      Tags to attach to the Volume.

    - `type: VolumeType`

      Type of the Volume.

      - `"nvme"`

      - `"abs"`

    - `updated_at: string`

      When the Volume was updated.

    - `vm_id: string`

      ID of the VM the Volume is attached to.

    - `vm_name: string`

      Name of the VM the Volume is attached to.

  - `pagination: Pagination`

    Pagination response details.

    - `next_cursor: string`

    - `previous_cursor: string`

    - `total_count: number`

### Example

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

#### Response

```json
{
  "items": [
    {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "created_at": "2025-01-01T00:00:00Z",
      "kind": "boot",
      "name": "my-volume",
      "project_id": "123e4567-e89b-12d3-a456-426614174000",
      "region": "us-sva-2",
      "size": 100,
      "status": "ready",
      "tags": [
        "production",
        "ethereum"
      ],
      "type": "abs",
      "updated_at": "2025-01-01T00:00:00Z",
      "vm_id": "123e4567-e89b-12d3-a456-426614174000",
      "vm_name": "my-vm"
    }
  ],
  "pagination": {
    "next_cursor": "RhwniMT4B74siYZcPF8TnCdGI1l9rpPvg",
    "previous_cursor": "ARhwnmi1hA7wEbHbMjdYQlOB_ZusP4fYvw",
    "total_count": 125
  }
}
```

## Attach Volume

**post** `/v1/compute/volumes/{volume_id}/attach`

Attach a volume to a VM

### Path Parameters

- `volume_id: string`

### Body Parameters

- `vm_id: string`

  ID of the VM to attach the Volume to.

### 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"`

  - `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"`

  - `updated_at: string`

    When the Operation was updated.

### Example

```http
curl https://api.nirvanalabs.io/v1/compute/volumes/$VOLUME_ID/attach \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $NIRVANA_LABS_API_KEY" \
    -d '{
          "vm_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"
}
```

## Detach Volume

**post** `/v1/compute/volumes/{volume_id}/detach`

Detach a volume from a VM

### Path Parameters

- `volume_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"`

  - `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"`

  - `updated_at: string`

    When the Operation was updated.

### Example

```http
curl https://api.nirvanalabs.io/v1/compute/volumes/$VOLUME_ID/detach \
    -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

### Volume

- `Volume object { id, created_at, kind, 10 more }`

  Volume details.

  - `id: string`

    Unique identifier for the Volume.

  - `created_at: string`

    When the Volume was created.

  - `kind: VolumeKind`

    Volume kind.

    - `"boot"`

    - `"data"`

  - `name: string`

    Name of the Volume.

  - `project_id: string`

    Project ID the Volume belongs to.

  - `region: RegionName`

    Region the resource is in.

    - `"us-sva-2"`

  - `size: number`

    Size of the Volume in GB.

  - `status: ResourceStatus`

    Status of the resource.

    - `"pending"`

    - `"creating"`

    - `"updating"`

    - `"ready"`

    - `"deleting"`

    - `"deleted"`

    - `"error"`

  - `tags: array of string`

    Tags to attach to the Volume.

  - `type: VolumeType`

    Type of the Volume.

    - `"nvme"`

    - `"abs"`

  - `updated_at: string`

    When the Volume was updated.

  - `vm_id: string`

    ID of the VM the Volume is attached to.

  - `vm_name: string`

    Name of the VM the Volume is attached to.

### Volume Kind

- `VolumeKind = "boot" or "data"`

  Volume kind.

  - `"boot"`

  - `"data"`

### Volume List

- `VolumeList object { items, pagination }`

  - `items: array of Volume`

    - `id: string`

      Unique identifier for the Volume.

    - `created_at: string`

      When the Volume was created.

    - `kind: VolumeKind`

      Volume kind.

      - `"boot"`

      - `"data"`

    - `name: string`

      Name of the Volume.

    - `project_id: string`

      Project ID the Volume belongs to.

    - `region: RegionName`

      Region the resource is in.

      - `"us-sva-2"`

    - `size: number`

      Size of the Volume in GB.

    - `status: ResourceStatus`

      Status of the resource.

      - `"pending"`

      - `"creating"`

      - `"updating"`

      - `"ready"`

      - `"deleting"`

      - `"deleted"`

      - `"error"`

    - `tags: array of string`

      Tags to attach to the Volume.

    - `type: VolumeType`

      Type of the Volume.

      - `"nvme"`

      - `"abs"`

    - `updated_at: string`

      When the Volume was updated.

    - `vm_id: string`

      ID of the VM the Volume is attached to.

    - `vm_name: string`

      Name of the VM the Volume is attached to.

  - `pagination: Pagination`

    Pagination response details.

    - `next_cursor: string`

    - `previous_cursor: string`

    - `total_count: number`

### Volume Type

- `VolumeType = "nvme" or "abs"`

  Type of the Volume.

  - `"nvme"`

  - `"abs"`

# Availability

## Check Volume Create Availability

**post** `/v1/compute/volumes/availability`

Check Volume Create Availability

### Body Parameters

- `name: string`

  Name of the Volume.

- `project_id: string`

  Project ID the Volume belongs to.

- `region: RegionName`

  Region the resource is in.

  - `"us-sva-2"`

- `size: number`

  Size of the Volume in GB.

- `type: VolumeType`

  Type of the Volume.

  - `"nvme"`

  - `"abs"`

- `tags: optional array of string`

  Tags to attach to the Volume.

- `vm_id: optional string`

  ID of the VM the Volume is attached to.

### Example

```http
curl https://api.nirvanalabs.io/v1/compute/volumes/availability \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $NIRVANA_LABS_API_KEY" \
    -d '{
          "name": "my-data-volume",
          "project_id": "123e4567-e89b-12d3-a456-426614174000",
          "region": "us-sva-2",
          "size": 100,
          "type": "abs",
          "tags": [
            "production",
            "ethereum"
          ],
          "vm_id": "123e4567-e89b-12d3-a456-426614174000"
        }'
```

## Check Volume Update Availability

**patch** `/v1/compute/volumes/{volume_id}/availability`

Check Volume Update Availability

### Path Parameters

- `volume_id: string`

### Body Parameters

- `name: optional string`

  Name of the Volume.

- `size: optional number`

  Size of the Volume in GB.

- `tags: optional array of string`

  Tags to attach to the Volume.

### Example

```http
curl https://api.nirvanalabs.io/v1/compute/volumes/$VOLUME_ID/availability \
    -X PATCH \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $NIRVANA_LABS_API_KEY" \
    -d '{
          "name": "my-data-volume",
          "size": 100,
          "tags": [
            "production",
            "ethereum"
          ]
        }'
```
