API Reference
Metrics & Stats
Get real-time performance metrics for your workspace - CPU, memory, network, and disk usage. Supports both one-shot queries and live SSE streaming.
Stats
Get current workspace statistics.
const stats = await ws.stats('ws_a1b2c3d4');
console.log(`CPU: ${stats.cpuUsage}%`);
console.log(`Memory: ${stats.memoryUsedMB}/${stats.memoryTotalMB} MB (${stats.memoryUsage}%)`);
console.log(`Network In: ${stats.networkIn}`);
console.log(`Network Out: ${stats.networkOut}`);
console.log(`Uptime: ${stats.uptime}s`);GET /workspace/:workspaceId/statscurl "https://api.oblien.com/workspace/ws_a1b2c3d4/stats" \
-H "X-Client-ID: $OBLIEN_CLIENT_ID" \
-H "X-Client-Secret: $OBLIEN_CLIENT_SECRET"Response
{
"success": true,
"stats": {
"cpuUsage": 12.5,
"memoryUsage": 45.2,
"memoryUsedMB": 230,
"memoryTotalMB": 512,
"guestMemoryUsed": 240000000,
"guestMemoryTotal": 536870912,
"guestDiskUsed": 104857600,
"guestDiskTotal": 536870912,
"networkIn": "1.2 MB",
"networkOut": "0.5 MB",
"networkInBytes": 1258291,
"networkOutBytes": 524288,
"uptime": 7200,
"apiCalls": 42
}
}Stats fields
| Field | Type | Description |
|---|---|---|
cpuUsage | number | CPU usage percentage (relative to allocated quota) |
memoryUsage | number | Memory usage percentage |
memoryUsedMB | number | Used memory in MB |
memoryTotalMB | number | Total allocated memory in MB |
guestMemoryUsed | number | Guest OS reported memory used (bytes) |
guestMemoryTotal | number | Guest OS reported memory total (bytes) |
guestDiskUsed | number | Guest OS reported disk used (bytes) |
guestDiskTotal | number | Guest OS reported disk total (bytes) |
networkIn | string | Human-readable inbound traffic |
networkOut | string | Human-readable outbound traffic |
networkInBytes | number | Raw inbound bytes |
networkOutBytes | number | Raw outbound bytes |
uptime | number | Seconds since last start |
apiCalls | number | Number of API calls to this workspace |
Stream
Stream live stats via Server-Sent Events. Updates are pushed at regular intervals with a 15-second heartbeat.
const stream = await ws.statsStream('ws_a1b2c3d4');
stream.on('data', (stats) => {
console.log(`CPU: ${stats.cpuUsage}% | Memory: ${stats.memoryUsage}%`);
});
// Stop streaming
stream.close();GET /workspace/:workspaceId/stats/streamReturns an SSE stream:
data: {"cpuUsage":12.5,"memoryUsage":45.2,"memoryUsedMB":230,...}
data: {"cpuUsage":15.1,"memoryUsage":46.0,"memoryUsedMB":235,...}curl -N "https://api.oblien.com/workspace/ws_a1b2c3d4/stats/stream" \
-H "X-Client-ID: $OBLIEN_CLIENT_ID" \
-H "X-Client-Secret: $OBLIEN_CLIENT_SECRET"Each SSE data event contains the same stats object as the one-shot stats endpoint. Close the connection to stop streaming.
Info
Get raw VM runtime information.
const info = await ws.info('ws_a1b2c3d4');GET /workspace/:workspaceId/infocurl "https://api.oblien.com/workspace/ws_a1b2c3d4/info" \
-H "X-Client-ID: $OBLIEN_CLIENT_ID" \
-H "X-Client-Secret: $OBLIEN_CLIENT_SECRET"Returns raw VM-level information including status, IP, and full configuration as reported by the hypervisor.
Config
Get raw VM configuration.
const config = await ws.config('ws_a1b2c3d4');GET /workspace/:workspaceId/configcurl "https://api.oblien.com/workspace/ws_a1b2c3d4/config" \
-H "X-Client-ID: $OBLIEN_CLIENT_ID" \
-H "X-Client-Secret: $OBLIEN_CLIENT_SECRET"Returns the full VM runtime configuration as stored on the hypervisor.