Skip to content

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

idstringrequired
The VPS ID (vps_…).

Example

GET /api/v2/vps/{id}/memory
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
}
}
Response fields
availableboolean
True when live figures could be read.
reasonstring or null
Why the figures are missing. Null when available is true.
memoryobject
Live memory figures. Only present when available is true.
totalGbnumber
Memory the operating system sees, in GB (1024³ bytes).
availableGbnumber
Memory free for new programs, in GB.
usedGbnumber
Memory in use, not counting cache, in GB.
usedPercentnumber
usedGb as a percentage of totalGb, to one decimal.
availablePercentnumber
availableGb as a percentage of totalGb, to one decimal.
buffersGbnumber
Memory used for buffers, in GB. 0 on Windows.
cachedGbnumber
Memory 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.

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.