ByCloud Docs
GuidesCLIAPISDK

JavaScript SDK

Block Storage

Volumes, snapshots, and backups

20 methods

GET

listBackups()

List backups

Parameters

limit

integer

- Maximum number of items to return

marker

string

- ID of the last item from the previous page (for pagination)

name

string

- Filter by name (exact match or prefix with *)

status

string

- Filter by status

volume_id

string

- Filter by volume ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.blockStorage.listBackups();
console.log(result);
POST

createBackup()

Create backup

Parameters

volume_id

string

required

- Volume to backup

name

string

description

string

container

string

- Backup container

incremental

boolean

- Create incremental backup

force

boolean

- Force backup even if volume is attached

snapshot_id

string

- Create backup from snapshot instead of volume

metadata

object

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.blockStorage.createBackup({
volume_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
GET

getBackup()

Get backup

Parameters

backup_id

string

required

- Backup ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.blockStorage.getBackup({
backup_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
DELETE

deleteBackup()

Delete backup

Parameters

backup_id

string

required

- Backup ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.blockStorage.deleteBackup({
backup_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
POST

restoreBackup()

Restore backup

Parameters

backup_id

string

required

- Backup ID

volume_id

string

- Existing volume to restore to (creates new volume if omitted)

name

string

- Name for new volume (if not restoring to existing)

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.blockStorage.restoreBackup({
backup_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
GET

listSnapshots()

List snapshots

Parameters

limit

integer

- Maximum number of items to return

marker

string

- ID of the last item from the previous page (for pagination)

name

string

- Filter by name (exact match or prefix with *)

status

string

- Filter by status

volume_id

string

- Filter by volume ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.blockStorage.listSnapshots();
console.log(result);
POST

createSnapshot()

Create snapshot

Parameters

volume_id

string

required

- Volume to snapshot

name

string

description

string

force

boolean

- Force snapshot even if volume is attached

metadata

object

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.blockStorage.createSnapshot({
volume_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
GET

getSnapshot()

Get snapshot

Parameters

snapshot_id

string

required

- Snapshot ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.blockStorage.getSnapshot({
snapshot_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
PATCH

updateSnapshot()

Update snapshot

Parameters

snapshot_id

string

required

- Snapshot ID

name

string

description

string

metadata

object

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.blockStorage.updateSnapshot({
snapshot_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
DELETE

deleteSnapshot()

Delete snapshot

Parameters

snapshot_id

string

required

- Snapshot ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.blockStorage.deleteSnapshot({
snapshot_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
GET

listVolumeTypes()

List volume types

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.blockStorage.listVolumeTypes();
console.log(result);
GET

getVolumeType()

Get volume type

Parameters

volume_type_id

string

required

- Volume Type ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.blockStorage.getVolumeType({
volume_type_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
GET

listVolumes()

List volumes

Parameters

limit

integer

- Maximum number of items to return

marker

string

- ID of the last item from the previous page (for pagination)

name

string

- Filter by name (exact match or prefix with *)

status

string

- Filter by status

bootable

boolean

- Filter by bootable status

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.blockStorage.listVolumes();
console.log(result);
POST

createVolume()

Create volume

Parameters

name

string

description

string

size

integer

required

- Size in GB

volume_type

string

- Volume type name or ID

snapshot_id

string

- Create volume from snapshot

source_volume_id

string

- Clone from existing volume

image_id

string

- Create volume from image

multiattach

boolean

metadata

object

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.blockStorage.createVolume({
size: 100
});
console.log(result);
GET

getVolume()

Get volume

Parameters

volume_id

string

required

- Volume ID

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.blockStorage.getVolume({
volume_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
PATCH

updateVolume()

Update volume

Parameters

volume_id

string

required

- Volume ID

name

string

description

string

metadata

object

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.blockStorage.updateVolume({
volume_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
DELETE

deleteVolume()

Delete volume

Parameters

volume_id

string

required

- Volume ID

force

boolean

- Force delete even if volume is in use

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.blockStorage.deleteVolume({
volume_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
POST

attachVolume()

Attach volume

Parameters

volume_id

string

required

- Volume ID

instance_id

string

required

- Instance to attach to

device

string

- Device name (e.g., /dev/vdb). Auto-assigned if omitted.

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.blockStorage.attachVolume({
volume_id: "550e8400-e29b-41d4-a716-446655440000",
instance_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
POST

detachVolume()

Detach volume

Parameters

volume_id

string

required

- Volume ID

instance_id

string

required

- Instance to detach from

force

boolean

- Force detach even if instance is running

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.blockStorage.detachVolume({
volume_id: "550e8400-e29b-41d4-a716-446655440000",
instance_id: "550e8400-e29b-41d4-a716-446655440000"
});
console.log(result);
POST

extendVolume()

Extend volume

Parameters

volume_id

string

required

- Volume ID

new_size

integer

required

- New size in GB (must be larger than current size)

Example

import { ByCloud } from "@bycoded/bycloud-sdk";
const client = new ByCloud({
token: "YOUR_ACCESS_TOKEN",
});
const result = await client.blockStorage.extendVolume({
volume_id: "550e8400-e29b-41d4-a716-446655440000",
new_size: 10
});
console.log(result);