Exposing Ports & Custom Domains
Expose sandbox ports to the internet with public URLs and custom subdomains.
Expose Port
POST /v1/sandboxes/:id/ports
Expose a port from a sandbox to the internet. Returns a public URL that routes to the specified port.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
port | number | Yes | Port number to expose (1-65535) |
visibility | string | No | public or private (default: public) |
subdomain | string | No | Custom subdomain (e.g. my-app → my-app.life.conway.tech) |
Example
curl -X POST "https://api.conway.tech/v1/sandboxes/sbx-abc123/ports?port=3000" \
-H "Authorization: Bearer your-api-key"Response
{
"port": 3000,
"public_url": "https://3000-sbx-abc123.life.conway.tech",
"subdomain": null
}URL Format
Every exposed port gets a default URL:
https://{port}-{short_id}.life.conway.techFor example:
- Port 3000 on
sbx-abc123→https://3000-sbx-abc123.life.conway.tech - Port 8080 on
sbx-xyz789→https://8080-sbx-xyz789.life.conway.tech
Custom Subdomains
You can assign a custom subdomain on life.conway.tech to any exposed port. This gives you a clean, memorable URL instead of the default {port}-{id} format.
curl -X POST "https://api.conway.tech/v1/sandboxes/sbx-abc123/ports?port=3000&subdomain=my-app" \
-H "Authorization: Bearer your-api-key"{
"port": 3000,
"public_url": "https://3000-sbx-abc123.life.conway.tech",
"custom_url": "https://my-app.life.conway.tech",
"subdomain": "my-app"
}Your app is now accessible at https://my-app.life.conway.tech.
Subdomain Rules
- 3-63 characters, lowercase alphanumeric and hyphens
- Cannot start or end with a hyphen
- Must be unique across all sandboxes
- Max 1 custom subdomain per sandbox -- setting a new one replaces the old one
- Reserved names (
www,api,app, etc.) are blocked
Connecting a Real Domain
For a fully custom domain (e.g. myapp.dev), combine Conway Cloud with Conway Domains:
- Expose the port with a custom subdomain:
sandbox_expose_port { sandbox_id: "...", port: 3000, subdomain: "my-app" }- Register a domain on Conway Domains:
domain_register { domain: "myapp.dev" }- Point the domain at your subdomain with a CNAME record:
domain_dns_add {
domain: "myapp.dev",
type: "CNAME",
host: "@",
value: "my-app.life.conway.tech"
}Now myapp.dev routes to your sandbox.
Unexpose Port
DELETE /v1/sandboxes/:id/ports/:port
Remove public access to a previously exposed port. If the port had a custom subdomain, it is also cleaned up.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The sandbox ID |
port | number | Yes | The port number to unexpose |
Example
curl -X DELETE https://api.conway.tech/v1/sandboxes/sbx-abc123/ports/3000 \
-H "Authorization: Bearer your-api-key"Response
{
"success": true,
"message": "Port 3000 unexposed",
"removed_subdomain": "my-app"
}