API Reference
Public Access
Expose ports on your workspace 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 /workspace/:workspaceId/public-accesscurl "https://api.oblien.com/workspace/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
Make a workspace port accessible from the internet. Returns a unique HTTPS preview URL.
const exposed = await ws.publicAccess.expose('ws_a1b2c3d4', {
port: 3000,
label: 'Web Server',
});
console.log(exposed.url);
// "https://a1b2c3.preview.oblien.com"POST /workspace/:workspaceId/public-access{
"port": 3000,
"label": "Web Server"
}curl -X POST "https://api.oblien.com/workspace/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" }'Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
port | number | Yes | Port number (1–65535) |
label | string | No | Human-readable label for the port |
Response
{
"success": true,
"port": {
"port": 3000,
"hash": "a1b2c3",
"label": "Web Server",
"url": "https://a1b2c3.preview.oblien.com"
}
}Limits
- Maximum 20 exposed ports per workspace
- Idempotent - re-exposing an already-exposed port refreshes the registration
- Workspace must be running to expose ports
Errors
| Code | Status | Cause |
|---|---|---|
vm_not_running | 409 | Workspace is not running |
invalid_port | 400 | Port number out of range |
limit_reached | 400 | Already at 20 exposed ports |
Revoke port
Remove a port from public access.
await ws.publicAccess.revoke('ws_a1b2c3d4', 3000);DELETE /workspace/:workspaceId/public-access/:portcurl -X DELETE "https://api.oblien.com/workspace/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 workspace's internal IP on the specified port - HTTPS termination is handled automatically - your workspace just needs to serve plain HTTP
Preview URLs are accessible to anyone with the link. For authenticated access, implement auth in your application.