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
idstringrequiredvps_…).Body
sizeGbintegerrequiredinterfacestringscsi.cachestringnone.Example
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.
{ "disk": { "id": "vpsdisk_01hxa3b4c5d6e7f8g9h0j1k2m3", "name": "scsi1", "sizeGb": 100, "interface": "scsi" }}Response fields
diskobjectidstringnamestringscsi1.sizeGbintegerinterfacestringErrors
Errors are Problem Details with a stable code. Branch on the code, not on the text.
| 400 | Invalid request. The response body is an RFC 7807 Problem Details document. |
| 401 | Unauthorized. Authentication is required. |
| 403 | The 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. |
| 404 | Not found. The resource does not exist or is not owned by the caller; code is vps_not_found. |
| 429 | Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers. |
| 500 | Internal error. Retry later or contact support if the issue persists. |