API Reference
Resources
View and update workspace compute resources - CPU cores, memory, and writable disk. Changes can be applied immediately (hot) or deferred to the next start.
Get resources
Get the current resource allocation for a workspace.
const resources = await ws.resources.get('ws_a1b2c3d4');
console.log(resources.cpus); // 2
console.log(resources.memory_mb); // 2048
console.log(resources.writable_size_mb); // 1024GET /workspace/:workspaceId/resourcescurl "https://api.oblien.com/workspace/ws_a1b2c3d4/resources" \
-H "X-Client-ID: $OBLIEN_CLIENT_ID" \
-H "X-Client-Secret: $OBLIEN_CLIENT_SECRET"Response
{
"success": true,
"resources": {
"cpus": 2,
"memory_mb": 2048,
"writable_size_mb": 1024,
"cpu_config": { "quota": "standard" },
"status": "running"
}
}Update resources
Change CPU, memory, or disk allocation. Use apply: true to apply changes immediately (restarts the VM), or apply: false to save changes for the next start.
// Apply immediately (restarts VM)
const result = await ws.resources.update('ws_a1b2c3d4', {
cpus: 4,
memory_mb: 4096,
apply: true,
});
console.log(result.updated); // { cpus: 4, memory_mb: 4096 }
console.log(result.relaunched); // true
// Save for next start
await ws.resources.update('ws_a1b2c3d4', {
writable_size_mb: 2048,
apply: false,
});PUT /workspace/:workspaceId/resources{
"cpus": 4,
"memory_mb": 4096,
"apply": true
}Also supports PATCH for partial updates.
curl -X PUT "https://api.oblien.com/workspace/ws_a1b2c3d4/resources" \
-H "X-Client-ID: $OBLIEN_CLIENT_ID" \
-H "X-Client-Secret: $OBLIEN_CLIENT_SECRET" \
-H "Content-Type: application/json" \
-d '{ "cpus": 4, "memory_mb": 4096, "apply": true }'Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
cpus | number | No | CPU cores (1–32, subject to plan) |
memory_mb | number | No | Memory in MB (128–65536, subject to plan) |
writable_size_mb | number | No | Disk in MB (64–204800, subject to plan) |
apply | boolean | No | true = relaunch VM immediately. false = save for next start |
Response
{
"success": true,
"updated": {
"cpus": 4,
"memory_mb": 4096,
"writable_size_mb": 1024
},
"relaunched": true
}Update behavior
| Change | Apply: true | Apply: false |
|---|---|---|
| CPU | Hot-applied, VM restarts | Saved, applied next start |
| Memory | Hot-applied, VM restarts | Saved, applied next start |
| Disk | VM stopped, resized, relaunched | Saved, applied next start |
Errors
| Code | Status | Cause |
|---|---|---|
invalid_resources | 400 | Values out of allowed range |
no_resources | 400 | No resource fields provided |
RESOURCE_NOT_ALLOWED | 403 | Exceeds per-workspace plan limits |
POOL_LIMIT_REACHED | 402 | Would exceed owned resource pool |
RUNNING_POOL_REACHED | 402 | Would exceed running resource pool (only with apply: true) |
VM_UNAVAILABLE | 503 | VM backend unreachable |
See the Pricing page for per-plan resource limits and Resource Pools for how pool quotas work.