Overview
Tunnels represent active connections that expose services through agents. The Tunnels API provides programmatic equivalents toconnect expose and connect reach CLI commands.
Create Tunnel
Create a new tunnel to expose a service (equivalent toconnect expose).
Target service in
host:port format, or object with host and port fieldsUUID of the agent that will expose this service
Tunnel name (auto-generated if not provided). 1-100 characters.
Protocol:
auto, tcp, udp, http, httpsMake publicly accessible via generated URL
Port on the hub where the tunnel is accessible
List Tunnels
Retrieve all active tunnels in the workspace.Get Tunnel Details
Retrieve details for a specific tunnel.Update Tunnel
Update tunnel properties like name, status, or metadata.New tunnel name (1-100 characters)
Tunnel status:
active or pausedCustom metadata (any JSON object)
Delete Tunnel
Delete a tunnel (equivalent to revoking/closing the exposed service).Connect to Tunnel
Initiate a connection to a tunnel (equivalent toconnect reach).
UUID of the agent that will receive the tunnel
Local port to bind (optional, uses target port if not specified)
Connection string formatted for the detected protocol (PostgreSQL, MySQL, Redis, MongoDB, HTTP, or generic TCP)
Create Share for Tunnel
Create a shareable link for a tunnel (equivalent toconnect share).
Share name (1-100 characters)
Share description (max 500 characters)
Expiration duration:
1h, 24h, 7d, 30d, neverHTTP methods to allow (for HTTP/HTTPS tunnels). Example:
["GET", "POST"]Rate limit per minute (1-1000)
Save the
shareUrl - it’s the link you’ll send to users for accessing the tunnel.Tunnel Status Values
Tunnels have the following status values:active- Tunnel is running and accepting connectionspaused- Tunnel exists but is not accepting connectionsconnecting- Tunnel is being establishederror- Tunnel encountered an error
Connection Strings
The API automatically generates protocol-specific connection strings:PostgreSQL (port 5432)
PostgreSQL (port 5432)
MySQL (port 3306)
MySQL (port 3306)
Redis (port 6379)
Redis (port 6379)
MongoDB (port 27017)
MongoDB (port 27017)
HTTP/HTTPS
HTTP/HTTPS
Generic TCP
Generic TCP
Use Cases
Database Access
Expose development or staging databases for team access without VPN.
API Testing
Share local APIs with external testers or clients.
Demo Environments
Create temporary tunnels for product demos.
CI/CD Integration
Programmatically create tunnels for automated testing pipelines.
Best Practices
- Use descriptive names - Name tunnels after their purpose:
staging-api,prod-db-readonly - Set appropriate TTLs - Use short-lived tunnels for temporary access, long-lived for permanent services
- Monitor usage - Use webhooks to track tunnel creation and deletion events
- Clean up - Delete tunnels when they’re no longer needed to reduce overhead
- Use shares - For external access, create shares with access control instead of making tunnels public