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.com
GET /workspace/:workspaceId/public-access
curl "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

ParameterTypeRequiredDescription
portnumberYesPort number (1–65535)
labelstringNoHuman-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

CodeStatusCause
vm_not_running409Workspace is not running
invalid_port400Port number out of range
limit_reached400Already at 20 exposed ports

Revoke port

Remove a port from public access.

await ws.publicAccess.revoke('ws_a1b2c3d4', 3000);
DELETE /workspace/:workspaceId/public-access/:port
curl -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:

  1. An entry is registered in the platform's routing layer
  2. A unique hash is generated for the URL
  3. All traffic to https://{hash}.preview.oblien.com is proxied to your workspace's internal IP on the specified port
  4. 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.