Skip to content

Add a disk to a VPS

POST /api/v2/vps/{id}/actions/add-disk

Add a new data disk to a VPS. To make an existing disk bigger, use POST /api/v2/vps/{id}/actions/resize-disk. The root disk grows through the storageGb option of POST /api/v2/vps/{id}/actions/config.

On a regular VPS the disk uses attachable storage you have already bought. sizeGb must be at most attachable.availableGb from GET /api/v2/vps/{id}/storage-quota. To buy more, send resources.additionalStorageGb to POST /api/v2/vps/{id}/actions/config. On a Cloud VPS the disk counts toward the account’s Cloud VPS storage limit. sizeGb must be at most remaining.storageGb from GET /api/v2/vps/payg/limits. Above the limit the call returns 403 cloud_storage_limit_exceeded.

The disk is attached when the call returns. It is empty. Partition, format, and mount it inside the operating system before you use it.

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

Request

Path parameters

idstringrequired
The VPS ID (vps_…).

Body

sizeGbintegerrequired
Size of the new disk in GB. A whole number from 1 to 1000. 1 to 1000.
interfacestring
Disk bus. Default scsi.
cachestring
Disk cache mode. Default none.

Example

POST /api/v2/vps/{id}/actions/add-disk
curl -X POST "https://cloud.hostup.se/api/v2/vps/vps_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/add-disk" \
-H "Authorization: Bearer $HOSTUP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"sizeGb": 100,
"interface": "scsi"
}'

Responses

200 The disk is attached.

Response 200
{
"disk": {
"id": "vpsdisk_01hxa3b4c5d6e7f8g9h0j1k2m3",
"name": "scsi1",
"sizeGb": 100,
"interface": "scsi"
}
}
Response fields
diskobject
idstring
The disk ID.
namestring
Device name of the disk on the VPS, for example scsi1.
sizeGbinteger
Size in GB.
interfacestring
Disk bus.

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.
403The disk cannot be added. cloud_storage_limit_exceeded: it would go over the Cloud VPS storage limit. forbidden: there is not enough attachable storage on a regular VPS. The same code comes back when the key may not change this VPS.
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.