The Tunnels API lets you establish and manage server-to-server (S2S) SSH tunnels and client-to-server (C2S) relay sessions. All tunnel operations require a valid JWT, which can be supplied as aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Termix-SSH/Termix/llms.txt
Use this file to discover all available pages before exploring further.
jwt cookie or a Bearer token in the Authorization header.
Tunnel connections are non-blocking: POST /ssh/tunnel/connect returns immediately and uses Server-Sent Events (SSE) or polling to track progress. A tunnel name uniquely identifies a tunnel and is constructed as {hostId}::{tunnelIndex}::{displayName}::{sourcePort}::{endpointHost}::{endpointPort}.
Get all tunnel statuses
Requires authentication via JWT cookie or
Authorization: Bearer <token> header.GET /ssh/tunnel/status
Returns a snapshot of every tunnel’s current status, keyed by tunnel name.
Status object for a single tunnel.
Example request
Example request
cURL
Example response (200)
Example response (200)
Stream tunnel status (SSE)
GET /ssh/tunnel/status/stream
Opens a Server-Sent Events stream that emits a statuses event containing the full status snapshot whenever any tunnel changes state. A : keepalive comment is sent every 30 seconds to keep the connection alive.
The response Content-Type is text/event-stream. Each message has the form:
Get tunnel status by name
GET /ssh/tunnel/status/:tunnelName
The fully-qualified tunnel name (e.g.
1::0::my-server::8080::endpoint::80).The tunnel name.
Status object identical to the entry in the all-statuses response.
Error responses
Error responses
| Status | Meaning |
|---|---|
| 401 | Authentication required. |
| 404 | Tunnel name not found in the status registry. |
Example request
Example request
cURL
Connect a tunnel
POST /ssh/tunnel/connect
Enqueues an SSH tunnel connection. Returns immediately; track progress via the status stream or polling.
Tunnel name in
{hostId}::{tunnelIndex}::{displayName}::{sourcePort}::{endpointHost}::{endpointPort} format.ID of the source SSH host in the Termix database.
Index of this tunnel in the host’s tunnel connection list.
IP address of the source host.
SSH port of the source host.
Username for the source host SSH connection.
Human-readable name or
user@ip identifier of the endpoint host.Port to expose on the endpoint host side.
Port to bind on the source host side.
Tunnel direction. One of
local, remote, or dynamic.Maximum number of reconnection attempts on failure.
Milliseconds to wait between retry attempts.
Whether this tunnel should reconnect automatically on server restart.
Confirmation message, always
"Connection request received".The tunnel name that was submitted.
Error responses
Error responses
| Status | Meaning |
|---|---|
| 400 | Missing or invalid tunnel configuration, or tunnel name does not match config fields. |
| 401 | Authentication required. |
| 403 | The authenticated user does not have read access to the source host. |
| 500 | Internal error while enqueuing the connection (e.g. endpoint host could not be resolved). |
Example request
Example request
cURL
Example response (200)
Example response (200)
Disconnect a tunnel
POST /ssh/tunnel/disconnect
Cleanly tears down an active tunnel connection. Sets the manualDisconnect flag so retries are suppressed.
Name of the tunnel to disconnect.
Confirmation message.
The tunnel name that was disconnected.
Error responses
Error responses
| Status | Meaning |
|---|---|
| 400 | tunnelName was not provided. |
| 401 | Authentication required. |
| 403 | User does not have access to the tunnel’s source host. |
| 500 | Internal error during cleanup. |
Example request
Example request
cURL
Cancel a tunnel retry
POST /ssh/tunnel/cancel
Cancels a pending retry sequence for a tunnel that is in the retrying or waiting state without retrying again.
Name of the tunnel whose retry should be cancelled.
Confirmation message.
The tunnel name.
Error responses
Error responses
| Status | Meaning |
|---|---|
| 400 | tunnelName was not provided. |
| 401 | Authentication required. |
| 403 | User does not have access to the tunnel’s source host. |
| 500 | Internal error during cleanup. |
Example request
Example request
cURL
C2S relay (WebSocket)
Client-to-server relay sessions are negotiated over WebSocket rather than HTTP. After upgrading the connection, send a JSONopen or test message to establish the relay.
Open message
Test message
Send"type": "test" with the same tunnelConfig to verify connectivity without keeping the relay open.
Server messages
type | Meaning |
|---|---|
ready | Relay is established and ready for data. For remote mode, includes bindHost and bindPort. |
connection | New inbound connection in remote mode. Includes streamId. |
data | Binary data for a remote-mode stream. Includes streamId and base64-encoded data. |
close | A stream was closed. Includes streamId. |
error | Fatal relay error. Includes error message string. |
For
local and dynamic modes, binary WebSocket frames carry raw TCP data after the initial ready acknowledgment.