Public Access
Expose ports on your VM to the public internet. Each exposed port gets a unique HTTPS preview URL.
List ports
Get all currently exposed ports.
const ports = await ws.publicAccess.list('ws_a1b2c3d4');
ports.forEach(p => {
console.log(`Port ${p.port}: ${p.url}`);
});
// Port 3000: https://a1b2c3.preview.oblien.com
// Port 8080: https://d4e5f6.preview.oblien.comGET /vms/:vmId/public-accesscurl "https://api.oblien.com/vms/ws_a1b2c3d4/public-access" \
-H "X-Client-ID: $OBLIEN_CLIENT_ID" \
-H "X-Client-Secret: $OBLIEN_CLIENT_SECRET"Response
{
"success": true,
"ports": [
{
"port": 3000,
"hash": "a1b2c3",
"label": "Web Server",
"url": "https://a1b2c3.preview.oblien.com"
},
{
"port": 8080,
"hash": "d4e5f6",
"label": "API",
"url": "https://d4e5f6.preview.oblien.com"
}
]
}Expose port
In the v2 dashboard, enable and save Public Access, then choose a port. Confirming publishes an HTTPS address after the VM host acknowledges Edge access to that port. The confirmation names the firewall policy in use. A split host grants Edge access to that port. A combined host uses the existing Private & Edge port list. Either operation preserves direct IPv6 rules. To require one mode, send firewall_mode: "separate" or "combined" with the v2 request. A changed mode returns HTTP 409 for review.
Make a VM port accessible from the internet. Returns a unique HTTPS preview URL.
const exposed = await ws.publicAccess.expose('ws_a1b2c3d4', {
port: 3000,
label: 'Web Server',
slug: 'my-app',
});
console.log(exposed.url);
// "https://my-app.preview.oblien.com"POST /vms/:vmId/public-access{
"port": 3000,
"label": "Web Server",
"slug": "my-app"
}curl -X POST "https://api.oblien.com/vms/ws_a1b2c3d4/public-access" \
-H "X-Client-ID: $OBLIEN_CLIENT_ID" \
-H "X-Client-Secret: $OBLIEN_CLIENT_SECRET" \
-H "Content-Type: application/json" \
-d '{ "port": 3000, "label": "Web Server", "slug": "my-app" }'Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
port | number | Yes | Port number (1–65535) |
label | string | No | Human-readable label for the port |
slug | string | No | Custom slug for the preview URL (1–48 chars, lowercase alphanumeric + hyphens). Auto-generated for a new port if omitted. |
domain | string | No | Base domain. Defaults to preview.oblien.com for a new port. Partner domains require a grant on the owning account; its namespace-scoped credentials inherit that grant. |
Response
{
"success": true,
"port": {
"port": 3000,
"hash": "my-app",
"label": "Web Server",
"url": "https://my-app.preview.oblien.com"
}
}Limits
- Maximum 20 exposed ports per VM
- Repeating the same port and address refreshes its registration. Omitted
sluganddomainretain that port's existing address. Deployment routing rules are preserved. - Requesting a different address for an already-exposed port returns
port_address_conflict, includingdetails.currentUrlanddetails.requestedUrl. Use the slug-update endpoint to rename it. To change its base domain, revoke the existing exposure and expose it again with the desireddomain. - VM must be running to expose ports
Errors
| Code | Status | Cause |
|---|---|---|
vm_not_running | 409 | VM is not running |
invalid_port | 400 | Port number out of range |
limit_reached | 409 | Already at 20 exposed ports |
slug_taken | 409 | Slug is already in use by another VM |
port_address_conflict | 409 | This port already has a different public address |
domain_not_allowed | 403 | The account has no grant for the requested base domain |
invalid_slug | 400 | Slug format invalid (must be 1–48 chars, lowercase alphanumeric + hyphens) |
Update slug
Change the slug (and URL) for an already-exposed port.
const updated = await ws.publicAccess.updateSlug('ws_a1b2c3d4', 3000, {
slug: 'new-slug',
});
console.log(updated.url);
// "https://new-slug.preview.oblien.com"PATCH /vms/:vmId/public-access/:port{
"slug": "new-slug"
}curl -X PATCH "https://api.oblien.com/vms/ws_a1b2c3d4/public-access/3000" \
-H "X-Client-ID: $OBLIEN_CLIENT_ID" \
-H "X-Client-Secret: $OBLIEN_CLIENT_SECRET" \
-H "Content-Type: application/json" \
-d '{ "slug": "new-slug" }'Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
slug | string | Yes | New slug (1–48 chars, lowercase alphanumeric + hyphens) |
Errors
| Code | Status | Cause |
|---|---|---|
slug_taken | 409 | Slug is already in use |
invalid_slug | 400 | Slug format invalid |
Revoke port
Remove a port from public access.
await ws.publicAccess.revoke('ws_a1b2c3d4', 3000);DELETE /vms/:vmId/public-access/:portcurl -X DELETE "https://api.oblien.com/vms/ws_a1b2c3d4/public-access/3000" \
-H "X-Client-ID: $OBLIEN_CLIENT_ID" \
-H "X-Client-Secret: $OBLIEN_CLIENT_SECRET"Response
{
"success": true,
"message": "Port 3000 revoked"
}How it works
When you expose a port:
- An entry is registered in the platform's routing layer
- A unique hash is generated for the URL
- All traffic to
https://{hash}.preview.oblien.comis proxied to your VM's internal IP on the specified port - HTTPS termination is handled automatically - your VM just needs to serve plain HTTP
Preview URLs are accessible to anyone with the link. For authenticated access, implement auth in your application.
Route wake policy
API v2 supports independent wake permission for each preview hostname and custom VM domain:
GET /v2/vms/{vmId}/public-access/wake?hostname=app.example.com
PUT /v2/vms/{vmId}/public-access/wake{ "hostname": "app.example.com", "auto_wake": false, "expected_revision": 3 }The response separates route permission from VM-wide automatic sleep:
{ "hostname": "app.example.com", "auto_wake": false, "revision": 4, "idle_enabled": true, "supported": true }A publication receipt can accompany the response; 202 means the durable edge update is pending. Existing routes default to auto_wake: true. Both this setting and VM automatic sleep must allow an automatic wake. Turning wake off preserves ordinary traffic and activity tracking for a running VM. Direct TCP and SSH do not auto-wake.
Reads require VM read access; changes require vm.network for the route’s owning VM and namespace. A route owned by another account, namespace or VM returns 404. The revision protects concurrent changes; stale writes return 409 route_wake_conflict. Read again and review before retrying. The API rechecks the policy under the VM operation lock even if an edge cache is stale.
const client = new Oblien({ token, baseUrl: 'https://api.oblien.com/v2' });
const access = client.vm(vmId).publicAccess;
const previous = await access.getRouteWake('app.example.com');
await access.setRouteWake({ hostname: previous.hostname, auto_wake: false,
expected_revision: previous.revision });Types: RouteWakeState, RouteWakeUpdateParams. CLI: public-access wake-get and wake-set; MCP: vm_route_wake_get and vm_route_wake_set. Configure API v2 explicitly for these new operations; the SDK’s default remains v1.