API Reference

Lifecycle & Power

Control VM power state and lifecycle mode. VMs can be permanent (persistent, optionally sleeping when idle) or temporary (auto-expire with TTL).

Sleep when idle

PUT /vms/:vmId/lifecycle/idle accepts { suspend_after: "15m", stop_after: 0 }. Use { suspend_after: 0 } to disable automatic sleep. The minimum idle time is 120 seconds; an optional nonzero memory-retention limit must be at least one hour. GET /vms/:vmId/lifecycle includes the normalized idle policy and snapshot_supported capability.

await ws.lifecycle.setIdle('ws_a1b2c3d4', { suspend_after: '15m' });
await ws.lifecycle.setIdle('ws_a1b2c3d4', null); // disable

The API rejects enabling this for temporary VMs or those without memory snapshot support. All exposed port URLs and connected custom domains share the VM policy and wake coordination. See Sleep and wake on request for setup, readiness, retries, keep-alives and memory retention.

While a power request is in progress, VM reads and lists report info.status as starting, stopping, restarting, pausing, or resuming, with ready: false. The dashboard shows this status immediately, keeps it after a page refresh, and polls every two seconds while the page is visible until the operation settles.

Power methods still wait for the operation to finish, so existing await ws.start(...) and await ws.stop(...) calls work as before. A separate GET /vms/:vmId can read progress during that wait. Use info.status for the transition; info.is_running describes the underlying VM process and may still be true while it shuts down.

Start

Start a stopped VM.

await ws.start('ws_a1b2c3d4');

// Force start (skip state checks)
await ws.start('ws_a1b2c3d4', { force: true });
POST /vms/:vmId/start
{ "force": true }
curl -X POST "https://api.oblien.com/vms/ws_a1b2c3d4/start" \
  -H "X-Client-ID: $OBLIEN_CLIENT_ID" \
  -H "X-Client-Secret: $OBLIEN_CLIENT_SECRET"

Parameters

ParameterTypeDefaultDescription
forcebooleanfalseForce start even if already running

Errors

CodeStatusCause
RUNNING_POOL_REACHED402Running pool quota full - stop another VM first
VM_UNAVAILABLE503VM backend is unreachable

Stop

Stop a running VM. The VM is shut down but data is preserved.

await ws.stop('ws_a1b2c3d4');
POST /vms/:vmId/stop
curl -X POST "https://api.oblien.com/vms/ws_a1b2c3d4/stop" \
  -H "X-Client-ID: $OBLIEN_CLIENT_ID" \
  -H "X-Client-Secret: $OBLIEN_CLIENT_SECRET"

Restart

Stop and immediately restart the VM.

await ws.restart('ws_a1b2c3d4');
POST /vms/:vmId/restart
curl -X POST "https://api.oblien.com/vms/ws_a1b2c3d4/restart" \
  -H "X-Client-ID: $OBLIEN_CLIENT_ID" \
  -H "X-Client-Secret: $OBLIEN_CLIENT_SECRET"

Pause

Freeze the VM - all processes are suspended, memory state is preserved. No CPU is consumed while paused.

await ws.pause('ws_a1b2c3d4');
POST /vms/:vmId/pause
curl -X POST "https://api.oblien.com/vms/ws_a1b2c3d4/pause" \
  -H "X-Client-ID: $OBLIEN_CLIENT_ID" \
  -H "X-Client-Secret: $OBLIEN_CLIENT_SECRET"

Resume

Resume a paused VM. Processes continue from where they were frozen.

await ws.resume('ws_a1b2c3d4');
POST /vms/:vmId/resume
curl -X POST "https://api.oblien.com/vms/ws_a1b2c3d4/resume" \
  -H "X-Client-ID: $OBLIEN_CLIENT_ID" \
  -H "X-Client-Secret: $OBLIEN_CLIENT_SECRET"

Get lifecycle

Get the current lifecycle configuration and status.

const lifecycle = await ws.lifecycle.get('ws_a1b2c3d4');
GET /vms/:vmId/lifecycle
curl "https://api.oblien.com/vms/ws_a1b2c3d4/lifecycle" \
  -H "X-Client-ID: $OBLIEN_CLIENT_ID" \
  -H "X-Client-Secret: $OBLIEN_CLIENT_SECRET"

Response

{
  "success": true,
  "mode": "permanent",
  "status": "running",
  "restart_policy": "always",
  "max_restarts": 0,
  "restart_info": {},
  "ttl": null,
  "ttl_action": null,
  "remove_on_exit": false,
  "uptime": 7200
}

Response fields

FieldTypeDescription
modestring"permanent" or "temporary"
statusstringCurrent VM status
restart_policystring"no", "always", "on-failure", or "unless-stopped"
max_restartsnumberMax restart attempts (0 = unlimited)
restart_infoobjectCurrent restart count and history
ttlstring|nullTime to live (e.g., "1h") — only for temporary mode
ttl_actionstring|null"stop", "pause", or "remove" — action on TTL expiry
remove_on_exitbooleanAuto-delete on VM exit (temporary mode only)
uptimenumberSeconds since last start

Make permanent

Convert a VM to permanent mode. Clears TTL, sets restart_policy (default "always"). Config-only — does not start or stop the VM.

// Default restart_policy = 'always'
const result = await ws.lifecycle.makePermanent('ws_a1b2c3d4');

// Or specify a restart policy
const result = await ws.lifecycle.makePermanent('ws_a1b2c3d4', {
  restart_policy: 'on-failure',
});
POST /vms/:vmId/lifecycle/permanent
{ "restart_policy": "on-failure" }
curl -X POST "https://api.oblien.com/vms/ws_a1b2c3d4/lifecycle/permanent" \
  -H "X-Client-ID: $OBLIEN_CLIENT_ID" \
  -H "X-Client-Secret: $OBLIEN_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{ "restart_policy": "always" }'

Parameters

ParameterTypeRequiredDefaultDescription
restart_policystringNo"always""no", "on-failure", "always", or "unless-stopped"

Permanent mode means:

  • restart_policy configurable (default "always")
  • No TTL — VM runs until you stop it
  • No ttl_action, no remove_on_exit
  • Static network IP assigned
  • Config applied hot — no VM restart needed

Make temporary

Convert a VM to temporary mode with a TTL.

const result = await ws.lifecycle.makeTemporary('ws_a1b2c3d4', {
  ttl: '1h',
  ttl_action: 'stop',
  remove_on_exit: false,
});
POST /vms/:vmId/lifecycle/temporary
{
  "ttl": "1h",
  "ttl_action": "stop",
  "remove_on_exit": false
}
curl -X POST "https://api.oblien.com/vms/ws_a1b2c3d4/lifecycle/temporary" \
  -H "X-Client-ID: $OBLIEN_CLIENT_ID" \
  -H "X-Client-Secret: $OBLIEN_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{ "ttl": "1h", "ttl_action": "stop" }'

Parameters

ParameterTypeRequiredDescription
ttlstring|numberYesDuration string (e.g., "30m", "1h", "24h") or seconds as number
ttl_actionstringNo"stop", "pause", or "remove". Default: "stop"
remove_on_exitbooleanNoAuto-delete when VM exits

restart_policy is always locked to "no" for temporary VMs. The Go VM server enforces: TTL > 0 → restart_policy = "no". This parameter is not accepted on this endpoint.


Update TTL

Change the TTL or TTL action on a temporary VM without mode conversion.

await ws.lifecycle.updateTtl('ws_a1b2c3d4', {
  ttl: '2h',
  ttl_action: 'remove',
});
PUT /vms/:vmId/lifecycle/ttl
{
  "ttl": "2h",
  "ttl_action": "remove"
}
curl -X PUT "https://api.oblien.com/vms/ws_a1b2c3d4/lifecycle/ttl" \
  -H "X-Client-ID: $OBLIEN_CLIENT_ID" \
  -H "X-Client-Secret: $OBLIEN_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{ "ttl": "2h", "ttl_action": "remove" }'

Parameters

At least one field is required:

ParameterTypeDescription
ttlstring|numberNew TTL duration (string or seconds)
ttl_actionstring"stop", "pause", or "remove"

restart_policy is not accepted — temporary VMs are locked to "no". All changes are applied hot — no VM relaunch required.


Ping

Keep-alive signal that renews the TTL on a temporary VM. Use this to prevent auto-expiry while a user is active.

await ws.lifecycle.ping('ws_a1b2c3d4', {
  ttl_seconds: 3600,
});
POST /vms/:vmId/ping
{ "ttl_seconds": 3600 }
curl -X POST "https://api.oblien.com/vms/ws_a1b2c3d4/ping" \
  -H "X-Client-ID: $OBLIEN_CLIENT_ID" \
  -H "X-Client-Secret: $OBLIEN_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{ "ttl_seconds": 3600 }'

Parameters

ParameterTypeDescription
ttl_secondsnumberOptional. Override TTL renewal duration in seconds

Destroy

Forcefully destroy the VMs. This stops the VM and deletes it from the hypervisor. The VM record remains in your account until you call delete.

await ws.lifecycle.destroy('ws_a1b2c3d4');
DELETE /vms/:vmId/lifecycle
curl -X DELETE "https://api.oblien.com/vms/ws_a1b2c3d4/lifecycle" \
  -H "X-Client-ID: $OBLIEN_CLIENT_ID" \
  -H "X-Client-Secret: $OBLIEN_CLIENT_SECRET"

Reinstall

Reset the VM to a fresh install of its base image, keeping the VM itself.

Use this when a VM has been broken or cluttered beyond repair and you want to start over without losing its identity — the same VM ID, URLs and settings keep working.

Destructive and irreversible. Everything written inside the VM is permanently deleted, including installed packages, changes to /root and /etc, and the contents of /vms. There is no undo and no automatic backup. To keep anything, create an archive first.

Kept: VM ID, IP address, hostname and public URLs, custom domains, image, CPU/memory/disk, network policy and ingress ports, metadata.

Reset: the entire filesystem, back to the base image. SSH is also switched off, because openssh-server lived in the erased filesystem — enable SSH again afterwards if you need it.

await ws.reinstall('ws_a1b2c3d4');
POST /vms/:vmId/reinstall
curl -X POST "https://api.oblien.com/vms/ws_a1b2c3d4/reinstall" \
  -H "X-Client-ID: $OBLIEN_CLIENT_ID" \
  -H "X-Client-Secret: $OBLIEN_CLIENT_SECRET"

Response

{
  "success": true,
  "vm_id": "ws_a1b2c3d4",
  "reinstalled": true,
  "running": true,
  "ip": "10.103.0.131",
  "message": "Sandbox reinstalled: filesystem reset to the base image, same vm id, IP and settings."
}

Response fields

FieldDescription
reinstalledtrue once the filesystem has been reset
runningWhether the VM had reported running again before the call returned
ipUnchanged — the VM keeps its address

Errors

CodeStatusMeaning
vm_missing409The VM has no VM to reset. It needs to be re-created rather than reinstalled.
stop_failed502The VM could not be stopped, so nothing was reset. It is left as it was.
overlay_delete_failed502The filesystem could not be reset. Nothing was deleted and the VM is started again.
relaunch_failed502The filesystem was reset but the VM did not start again. Its data is already cleared; call start to finish the reinstall.

A reinstall boots from the VM's stored settings, so any change you made since it last started — resources, network policy, ingress ports — is applied by the reinstall.


Learn more about lifecycle modes in Concepts: Modes.