Get live memory use of a VPS
GET /api/v2/vps/{id}/memory
Reads live memory use from inside the VPS through the QEMU Guest Agent. The VPS must be running and the agent must be installed and running in it. When the figures cannot be read, available is false, reason says why and memory is left out. The memory size of the plan is on GET /api/v2/vps/{id}. Memory graphs over time are on GET /api/v2/vps/{id}/metrics.
Authentication: An API key with the scope read:vm. About keys and scopes
Request
Path parameters
idstringrequiredThe VPS ID (
vps_…).Example
curl "https://cloud.hostup.se/api/v2/vps/vps_01hxa3b4c5d6e7f8g9h0j1k2m3/memory" \ -H "Authorization: Bearer $HOSTUP_API_KEY"Responses
200 Live memory use. When it cannot be read, the reason why.
{ "available": true, "reason": null, "memory": { "totalGb": 4, "availableGb": 2.75, "usedGb": 1.25, "usedPercent": 31.3, "availablePercent": 68.8, "buffersGb": 0.12, "cachedGb": 0.8 }}{ "available": false, "reason": "VM is not running. Start the VM to read guest memory."}Response fields
availablebooleanTrue when live figures could be read.
reasonstring or nullWhy the figures are missing. Null when
available is true.memoryobjectLive memory figures. Only present when
available is true.totalGbnumberMemory the operating system sees, in GB (1024³ bytes).
availableGbnumberMemory free for new programs, in GB.
usedGbnumberMemory in use, not counting cache, in GB.
usedPercentnumberusedGb as a percentage of totalGb, to one decimal.availablePercentnumberavailableGb as a percentage of totalGb, to one decimal.buffersGbnumberMemory used for buffers, in GB. 0 on Windows.
cachedGbnumberMemory used for cache, in GB. 0 on Windows.
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 | Forbidden. The caller lacks a required scope or does not own the resource. |
| 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. |