Skip to main content

Documentation 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.

The Server Stats API provides host availability status and detailed system metrics collected over SSH. Status is determined via TCP ping; metrics require an SSH connection and are collected for SSH hosts with password or key-based authentication. All endpoints require JWT authentication. Metrics collection is background-polled on a configurable interval; the API returns the most-recently-cached snapshot. Admin endpoints for global settings also require admin privileges.

Host status

Get all host statuses

GET /status Returns the current online/offline status for all of the authenticated user’s hosts.
[hostId]
object
Status entry keyed by numeric host ID.
StatusMeaning
401Session expired.
cURL
curl -X GET https://your-termix-host/status \
  -H "Authorization: Bearer <token>"
{
  "5": {"status": "online", "lastChecked": "2026-05-09T14:22:10.000Z"},
  "6": {"status": "offline", "lastChecked": "2026-05-09T14:22:05.000Z"}
}

Get host status by ID

GET /status/:id
id
number
required
Host ID. Must be a positive integer.
status
string
"online" or "offline".
lastChecked
string
ISO 8601 timestamp.
StatusMeaning
400Invalid host ID.
401Session expired.
404Status not yet available (polling may not have run yet).

Metrics

Get host metrics

GET /metrics/:id Returns the latest cached metrics snapshot for a host. Metrics include CPU, memory, disk, network, uptime, processes, system info, login history, open ports, and firewall rules.
id
number
required
Host ID.
cpu
object
memory
object
disk
object
network
object
uptime
object
processes
object
system
object
login_stats
object
Login history with recentLogins, failedLogins, totalLogins, and uniqueIPs.
ports
object
Open port information with source ("ss", "netstat", or "none") and a ports array.
firewall
object
Firewall configuration with type ("iptables", "nftables", or "none"), status, and a chains array.
lastChecked
string
ISO 8601 timestamp of when this snapshot was collected.
StatusMeaning
400Invalid host ID.
401Session expired.
404No metrics snapshot available yet. Returns empty null-filled metric objects.
cURL
curl -X GET https://your-termix-host/metrics/5 \
  -H "Authorization: Bearer <token>"

Start metrics collection

POST /metrics/start/:id Establishes an SSH connection for a host and starts background metrics polling. Call this when a user opens the server-stats view for a host.
id
number
required
Host ID.
Returns structured connectionLogs and one of:
  • {"status": "success", ...} on immediate connection.
  • {"requires_totp": true, "sessionId": "...", ...} when TOTP is needed.
StatusMeaning
400Invalid host ID.
401Session expired.
404Host not found.
500SSH connection failed.

Stop metrics collection

POST /metrics/stop/:id Stops background metrics polling for a host and terminates its SSH connection.
id
number
required
Host ID.

Verify metrics TOTP

POST /metrics/connect-totp Completes a pending metrics SSH connection by submitting a TOTP code.
sessionId
string
required
Session ID from the POST /metrics/start/:id response.
totpCode
string
required
One-time code.

Register metrics viewer

POST /metrics/register-viewer Registers the client as an active viewer for a host’s metrics, triggering full metrics collection if not already running.
hostId
number
required
Host ID.
sessionId
string
required
A client-generated viewer session ID used for heartbeat tracking.

Unregister metrics viewer

POST /metrics/unregister-viewer Removes the client viewer registration. When no viewers remain for a host, active metrics polling is suspended.
hostId
number
required
Host ID.
sessionId
string
required
Viewer session ID to unregister.

Metrics heartbeat

POST /metrics/heartbeat Updates the last-active timestamp for a viewer session. Send this every 60 seconds or less to prevent the server from automatically expiring the viewer session after 2 minutes of inactivity.
sessionId
string
required
Viewer session ID.
success
boolean
true if the heartbeat was accepted.
found
boolean
false if the session was not recognized (re-register).

Polling control

Refresh polling

POST /refresh Clears all SSH connections from the pool and restarts host polling for the user.
cURL
curl -X POST https://your-termix-host/refresh \
  -H "Authorization: Bearer <token>"

Clear all SSH connections

POST /clear-connections Clears all cached SSH connections from the connection pool without restarting polling timers.

Notify host updated

POST /host-updated Notifies the stats service that a host’s configuration has changed. This clears the cached SSH connection for the host and restarts its polling.
hostId
number
required
Host ID.
StatusMeaning
400Invalid hostId.
401Session expired.
404Host not found.
500Failed to restart polling.

Notify host deleted

POST /host-deleted Stops all polling for a deleted host and removes its status/metrics from memory.
hostId
number
required
Host ID.

Global settings

Get global settings

GET /global-settings
Requires admin privileges.
Returns the global polling interval settings that apply to all hosts configured to use global defaults.
globalStatusCheckInterval
number
Status check interval in seconds.
globalMetricsInterval
number
Metrics collection interval in seconds.

Update global settings

POST /global-settings
Requires admin privileges.
globalStatusCheckInterval
number
New status check interval in seconds. Must be between 10 and 3600.
globalMetricsInterval
number
New metrics collection interval in seconds. Must be between 10 and 3600.
cURL
curl -X POST https://your-termix-host/global-settings \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"globalStatusCheckInterval": 30, "globalMetricsInterval": 60}'

Build docs developers (and LLMs) love