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/stats
curl "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

FieldTypeDescription
cpuUsagenumberCPU usage percentage (relative to allocated quota)
memoryUsagenumberMemory usage percentage
memoryUsedMBnumberUsed memory in MB
memoryTotalMBnumberTotal allocated memory in MB
guestMemoryUsednumberGuest OS reported memory used (bytes)
guestMemoryTotalnumberGuest OS reported memory total (bytes)
guestDiskUsednumberGuest OS reported disk used (bytes)
guestDiskTotalnumberGuest OS reported disk total (bytes)
networkInstringHuman-readable inbound traffic
networkOutstringHuman-readable outbound traffic
networkInBytesnumberRaw inbound bytes
networkOutBytesnumberRaw outbound bytes
uptimenumberSeconds since last start
apiCallsnumberNumber 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/stream

Returns 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/info
curl "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/config
curl "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.