Skip to content

Delete a VPS disk

DELETE /api/v2/vps/{id}/disks/{diskName}

Remove a disk from the VPS and delete it with all its data. Pass the disk’s id (vpsdisk_…) from GET /api/v2/vps/{id}/disks. Check actions.canDetach there first. The VPS must be active. The boot disk cannot be removed (403). On a VPS with a fixed plan, some disks can only be removed by support (403). On a Cloud VPS, keepVolume=true detaches the disk and keeps it as a volume you can attach again. A kept volume stays tied to this VPS. It blocks a reinstall of the VPS until you delete the volume with DELETE /api/v2/volumes/{id}. Without keepVolume the data cannot be recovered. A deleted Cloud VPS disk no longer counts toward your account’s Cloud VPS disk usage. A kept volume still counts.

Authentication: An API key with the scopes write:vm and write:storage. About keys and scopes

Request

Path parameters

idstringrequired
The VPS ID (vps_…).
diskNamestringrequired
The disk ID (vpsdisk_…) from the disk list.

Query parameters

keepVolumeboolean
true keeps the disk as a volume instead of deleting it. Cloud VPS only. Any other VPS answers 400. Default false. Default false.

Example

DELETE /api/v2/vps/{id}/disks/{diskName}
curl -X DELETE "https://cloud.hostup.se/api/v2/vps/vps_01hxa3b4c5d6e7f8g9h0j1k2m3/disks/scsi0" \
-H "Authorization: Bearer $HOSTUP_API_KEY"

Responses

204 Disk removed.

Errors

Errors are Problem Details with a stable code. Branch on the code, not on the text.

400Invalid request. The response body is an RFC 7807 Problem Details document.
401Unauthorized. Authentication is required.
403Forbidden. The caller lacks a required scope or does not own the resource.
404Not found. The resource does not exist or is not owned by the caller; code is vps_not_found.
429Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers.
500Internal error. Retry later or contact support if the issue persists.