Volume API

Volume API

Create block volumes, manage attachments, resize, and request snapshots.

The Volume API manages persistent block devices within a project and region. Volume operations follow the API concurrency and idempotency rules.

Create a volume

POST/organizations/{organization_id}/projects/{project_id}/volumes
Scope
volumes:write
Auth
Bearer API key
Repeat calls
Reuse the same Idempotency-Key for a retried creation request.

Creates an empty volume or restores a snapshot into a new volume.

Request body
namestringrequired
Display name after trimming surrounding whitespace.
rule1–128 characters
region_idstringrequired
Region permitted for the project.
storage_policy_idstringrequired
Compatible storage policy in that region.
size_gibintegerrequired
Provisioned size within the policy limit. Must not be smaller than a restore source.
ruleAt least 1 GiB
source_snapshot_idstringoptional
Ready snapshot in the same region. Omission creates an empty volume.
defaultOmitted
labelsobjectoptional
String-pair labels for selection and ownership.
default{}

Explicit null is invalid for the optional snapshot field. Use omission for an empty volume. Invalid policy, insufficient quota, or inadequate eligible pool capacity returns 422 with the corresponding error code.

202Creation accepted

An accepted creation returns the new volume and its operation:

JSON
{
  "data": { "id": "vol_data01", "state": "creating" },
  "operation": { "id": "op_volume01", "state": "queued" },
  "request_id": "req_storage01"
}

Wait for the operation before attaching the volume. A new empty volume has no filesystem; a restored volume retains its captured data.

Read and list

GET/organizations/{organization_id}/projects/{project_id}/volumes/{volume_id}
Scope
volumes:read
Auth
Bearer API key

Returns id, revision, name, region_id, storage_policy_id, size_gib, state, health, attachments, and labels. Requires volumes:read. The response includes the configuration ETag.

GET/organizations/{organization_id}/projects/{project_id}/volumes
Scope
volumes:read
Auth
Bearer API key

Lists volumes using the selected region, state, and label filters.

List the collection with filters region_id, state, and label and the standard pagination parameters. States include creating, available, attached, resizing, deleting, and error. Replica health is reported separately from lifecycle state.

Attach

POST/organizations/{organization_id}/projects/{project_id}/volumes/{volume_id}/attachments
Scope
volumes:write
Auth
Bearer API key

Creates a writable volume attachment for the target droplet.

Requires volumes:write, access to the target droplet, and the volume's current If-Match. Send droplet_id as a required string. The writable attachment mode is read_write, which is also the default; unsupported modes are rejected.

The response is 202 with an attachment summary and operation. A second writable attachment returns 409 volume_in_use. A different project or region returns 422 invalid_reference. The guest must discover and mount the device separately.

Detach

DELETE/organizations/{organization_id}/projects/{project_id}/volumes/{volume_id}/attachments/{attachment_id}
Scope
volumes:write
Auth
Bearer API key

Detaches the selected volume attachment.

Requires volumes:write and the current volume revision. A root attachment requires a stopped droplet. A data attachment requires guest writes to have stopped before removal.

The API does not infer whether an application has safely unmounted its filesystem. An unreachable writer returns a conflict until ownership and fencing are resolved. See Detach a volume.

Expand

POST/organizations/{organization_id}/projects/{project_id}/volumes/{volume_id}/actions
Scope
volumes:write
Auth
Bearer API key

Expands the volume's block-device capacity.

Send type=resize and positive integer size_gib with the current If-Match. The requested value must exceed the current size and fit policy and quota limits. A smaller or equal size returns 422 invalid_size.

The operation expands the block device. It does not expand a guest partition or filesystem. A completed expansion cannot be reversed by another resize request.

Snapshot

POST/organizations/{organization_id}/projects/{project_id}/volumes/{volume_id}/snapshots
Scope
volumes:write
Auth
Bearer API key

Captures a volume snapshot with the requested consistency mode.

Requires volumes:write. Send name and optional consistency, whose values are crash, guest, or application, with default crash. Application mode requires hook_set_id referencing an approved guest hook set. Unsupported required consistency returns 422 unsupported_consistency; it does not downgrade the request.

The 202 response identifies the snapshot and operation. Use only a ready, complete recovery point for restoration. Snapshots documents groups, freeze behavior, and retained capacity.

Delete

DELETE/organizations/{organization_id}/projects/{project_id}/volumes/{volume_id}
Scope
volumes:write
Auth
Bearer API key

Deletes an unattached volume while retaining independent recovery copies.

Requires volumes:write and If-Match. Active attachments return 409 volume_in_use. Accepted deletion returns 202; retained snapshots and independent backups keep their own lifecycle. Inspect the operation for cleanup failures before assuming pool capacity was released.

I/O policy overrides

PATCH/organizations/{organization_id}/projects/{project_id}/volumes/{volume_id}/performance
Scope
volumes:write
Auth
Bearer API key

Updates explicit volume I/O limits.

Requires volumes:write and the volume ETag. Writable fields are read_iops, write_iops, read_bytes_per_second, and write_bytes_per_second.

A positive integer sets an explicit cap; null removes that field's override and restores policy inheritance. Omission preserves the current override. Zero, fractions, unsupported fields, and values above policy ceilings return 422 without changing the submitted override set.

Accepted application returns 202. Reads report requested and effective values and their policy sources. Limits do not reserve a minimum service rate. See storage performance and discard accounting.