Volumes API
Volumes are persistent block storage devices that can be attached to Droplets. Each volume is backed by a Kubernetes PersistentVolumeClaim.
List Volumes
Response:
[
{
"id": "vol_a1b2c3d4",
"project_id": "proj_default",
"name": "data-volume",
"size_gb": 50,
"status": "attached",
"attached_to": "dpl_e5f6g7h8",
"region": "nyc1",
"created_at": "2024-01-15T10:30:00Z"
}
]
Create a Volume
{
"name": "data-volume",
"size_gb": 50,
"region": "nyc1"
}
Response: 201 Created
{
"id": "vol_a1b2c3d4",
"name": "data-volume",
"size_gb": 50,
"status": "creating",
"region": "nyc1",
"created_at": "2024-01-15T10:30:00Z"
}
Get a Volume
Delete a Volume
DELETE /api/v1/volumes/{id}
A volume must be detached from all Droplets before it can be deleted. Data is permanently lost.
Volume Status
| Status | Description |
|---|
creating | PVC is being provisioned |
available | Ready to attach to a Droplet |
attached | Currently mounted on a Droplet |
deleting | Being permanently removed |
Attaching Volumes
Volumes are attached to Droplets at creation time via the volume_ids field, or can be managed through Droplet update operations.
POST /api/v1/droplets
{
"name": "db-server",
"image": "ubuntu-22-04",
"plan_id": "s-2vcpu-2gb",
"region": "nyc1",
"volume_ids": ["vol_a1b2c3d4"]
}