Resize a VPS disk
POST /api/v2/vps/{id}/actions/resize-disk
Make an existing disk on a VPS bigger. Find diskId and the disk’s actions.canResize gate with GET /api/v2/vps/{id}/disks. With incremental: true, sizeGb is the amount to add. Otherwise it is the new size of the disk.
On a regular VPS this works for extra disks. The growth uses attachable storage you have already bought. It must be at most attachable.availableGb from GET /api/v2/vps/{id}/storage-quota. Buy more with resources.additionalStorageGb on POST /api/v2/vps/{id}/actions/config. The primary disk of a regular VPS grows through the storageGb option of the same endpoint. This call refuses it with 403. On a Cloud VPS the growth counts toward the account’s Cloud VPS storage limit. It 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 bigger when the call returns. Grow the partition and the file system inside the operating system to use the new space.
Authentication: An API key with the scopes write:vm and write:storage. About keys and scopes
Request
Path parameters
idstringrequiredvps_…).Body
diskIdstringrequiredvpsdisk_…) from GET /api/v2/vps/{id}/disks.sizeGbintegerrequiredincremental: true, otherwise the new size in GB. A whole number from 1 to 1000. 1 to 1000.incrementalbooleansizeGb to the current size instead of setting it. Default false.Example
curl -X POST "https://cloud.hostup.se/api/v2/vps/vps_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/resize-disk" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "diskId": "vpsdisk_01hxa3b4c5d6e7f8g9h0j1k2m3", "sizeGb": 50, "incremental": true }'curl -X POST "https://cloud.hostup.se/api/v2/vps/vps_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/resize-disk" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "diskId": "vpsdisk_01hxa3b4c5d6e7f8g9h0j1k2m3", "sizeGb": 150, "incremental": false }'Responses
200 The disk is resized.
{ "disk": { "id": "vpsdisk_01hxa3b4c5d6e7f8g9h0j1k2m3", "sizeGb": 50, "incremental": true }}Response fields
diskobjectidstringsizeGbintegersizeGb you sent. With incremental: true it is the amount added, not the new size.incrementalbooleanincremental you sent.Errors
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 grow. cloud_storage_limit_exceeded: it would go over the Cloud VPS storage limit. forbidden: there is not enough attachable storage. The same code comes back for the primary disk of a regular VPS and 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. |