Runtime API Access
Manage the VM's internal server and access tokens. This is the Oblien API side of the VM Runtime API - use these endpoints to enable the server, get tokens, and control access before making calls to vm.oblien.com.
Server status
Check if the internal server is enabled and running.
const status = await ws.apiAccess.status('ws_a1b2c3d4');
console.log(status.enabled); // true
console.log(status.running); // trueGET /vms/:vmId/runtime-api-accesscurl "https://api.oblien.com/vms/ws_a1b2c3d4/runtime-api-access" \
-H "X-Client-ID: $OBLIEN_CLIENT_ID" \
-H "X-Client-Secret: $OBLIEN_CLIENT_SECRET"Enable server
Enable the internal HTTP server on port 9990 inside the VMs. Returns a signed Gateway JWT for accessing the Runtime API at vm.oblien.com.
This automatically adds port 9990 to the VM's ingress_ports if not already present.
For gateway access to work, the VM must also have public_access: true in its network configuration. This allows the gateway to reach the VM through the firewall. Enable it via the Network API if not already set.
const result = await ws.apiAccess.enable('ws_a1b2c3d4');
console.log(result.token); // Gateway JWT - use with vm.oblien.comPOST /vms/:vmId/runtime-api-access/enablecurl -X POST "https://api.oblien.com/vms/ws_a1b2c3d4/runtime-api-access/enable" \
-H "X-Client-ID: $OBLIEN_CLIENT_ID" \
-H "X-Client-Secret: $OBLIEN_CLIENT_SECRET"Response
{
"success": true,
"enabled": true,
"token": "eyJhbG..."
}The returned token is a short-lived Gateway JWT (~1 hour) that you use as Authorization: Bearer <token> when calling vm.oblien.com endpoints.
Disable server
Disable the internal server.
await ws.apiAccess.disable('ws_a1b2c3d4');POST /vms/:vmId/runtime-api-access/disablecurl -X POST "https://api.oblien.com/vms/ws_a1b2c3d4/runtime-api-access/disable" \
-H "X-Client-ID: $OBLIEN_CLIENT_ID" \
-H "X-Client-Secret: $OBLIEN_CLIENT_SECRET"Response
{
"success": true,
"enabled": false
}Rotate token
Rotate the connection token and return a fresh Gateway JWT. Use this to invalidate old tokens.
const result = await ws.apiAccess.rotateToken('ws_a1b2c3d4');
console.log(result.token); // Fresh gateway JWTPOST /vms/:vmId/runtime-api-access/tokencurl -X POST "https://api.oblien.com/vms/ws_a1b2c3d4/runtime-api-access/token" \
-H "X-Client-ID: $OBLIEN_CLIENT_ID" \
-H "X-Client-Secret: $OBLIEN_CLIENT_SECRET"Response
{
"success": true,
"token": "eyJhbG..."
}Raw token
Get the raw connection token and VM private IP. Use this for VM-to-VM communication over the internal network, bypassing the edge gateway.
Direct VM-to-VM calls require a private link between the two VMs. Without a link, the target's firewall blocks the connection regardless of having a valid token.
const raw = await ws.apiAccess.rawToken('ws_a1b2c3d4');
console.log(raw.token); // hex connection token
console.log(raw.ip); // "10.x.x.x"
console.log(raw.port); // 9990GET /vms/:vmId/runtime-api-access/token/rawcurl "https://api.oblien.com/vms/ws_a1b2c3d4/runtime-api-access/token/raw" \
-H "X-Client-ID: $OBLIEN_CLIENT_ID" \
-H "X-Client-Secret: $OBLIEN_CLIENT_SECRET"Response
{
"success": true,
"token": "a1b2c3d4e5f6...",
"ip": "10.40.0.5",
"port": 9990
}Use the raw token with Authorization: Bearer <token> when calling the target VM directly:
curl "http://10.40.0.5:9990/files?path=/app" \
-H "Authorization: Bearer a1b2c3d4e5f6..."Requires a private link between the two VMs.
Endpoint summary
| Endpoint | Method | Description |
|---|---|---|
/runtime-api-access | GET | Server status |
/runtime-api-access/enable | POST | Enable server, get Gateway JWT |
/runtime-api-access/disable | POST | Disable server |
/runtime-api-access/token | GET | Current Gateway JWT |
/runtime-api-access/token | POST | Rotate token, get fresh Gateway JWT |
/runtime-api-access/token/raw | GET | Raw connection token + VM IP |