Ports
Expose and unexpose ports on sandboxes.
Expose Port
POST /v1/sandboxes/:id/ports?port=<port>
Expose a port from a sandbox to the internet. Returns a public URL that routes to the specified port.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The sandbox ID (short ID or full ID) |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
port | number | Yes | Port number to expose (1-65535) |
Example
curl -X POST "https://api.conway.tech/v1/sandboxes/sbx-abc123/ports?port=3000" \
-H "Authorization: Bearer your-api-key"const response = await fetch(
"https://api.conway.tech/v1/sandboxes/sbx-abc123/ports?port=3000",
{
method: "POST",
headers: { Authorization: "Bearer your-api-key" },
}
);Response
{
"port": 3000,
"public_url": "https://3000-sbx-abc123.life.conway.tech"
}URL Format
Exposed ports are accessible at:
https://{port}-{short_id}.life.conway.techFor example:
- Port 3000 on sandbox
sbx-abc123→https://3000-sbx-abc123.life.conway.tech - Port 8080 on sandbox
sbx-xyz789→https://8080-sbx-xyz789.life.conway.tech
Use Cases
- Web servers: Expose Express, Flask, or other web apps
- APIs: Make REST or GraphQL APIs publicly accessible
- Databases: Expose database admin UIs (use with caution)
- Development: Share work-in-progress with teammates
Unexpose Port
DELETE /v1/sandboxes/:id/ports/:port
Remove public access to a previously exposed port.
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"await fetch("https://api.conway.tech/v1/sandboxes/sbx-abc123/ports/3000", {
method: "DELETE",
headers: { Authorization: "Bearer your-api-key" },
});Response
{
"success": true,
"message": "Port 3000 unexposed"
}