CMonitor REST API & Fleet Reference
CMonitor exposes a high-performance HTTP API for active proxy probing, tester fleet network diagnostics (ICMP ping, TCP port verification, cached ASN/BGP/ISP inspection), ephemeral subscription checks, and independent alert automation.
Authentication
CMonitor supports three authentication mechanisms for interactive browsers, local AI assistants, automated scripts, and collector nodes:
1. Scoped API Key (Scripts & AI Tools)
Send Authorization: Bearer cmon_... or X-API-Key: cmon_.... Designed for automated repair tools and MCP clients. Scoped strictly to your account with read_only, read_test, or full permissions, optional group restrictions, and rate limiting. No session login required.
2. Session Cookie (Web Dashboard)
Obtained by calling POST /api/auth/login with JSON credentials. Returns an HTTP-only tw.sid session cookie. Used by the interactive dashboard UI.
3. Agent Bearer Token
Supplied via Authorization: Bearer <TW_AGENT_TOKEN> header. Used for automated probe synchronization between collector nodes and the panel.
curl -H "Authorization: Bearer cmon_your_api_key_here" \ https://cmonitor.realkia.com/api/vless
curl -c cookies.txt -X POST https://cmonitor.realkia.com/api/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"your_username","password":"your_password"}'
Server-Sent Events (SSE) Streaming
Diagnostic tools like Net Tools (Ping, TCP) and Subscription Quick Check support progressive Server-Sent Events. Clients can pass stream=true or send Accept: text/event-stream. Individual tester results are streamed as they finish so clients never have to wait for the slowest node to view faster ones.
data: {"type":"result","result":{...}} per tester node, terminated by data: {"type":"done","results":[...]}.
β‘ Net Tools (Network Diagnostics)
Live network diagnostics executed directly from your distributed tester fleet. No configurations are saved and no monitoring history is retained.
Request Body
| Field | Type | Requirement | Description |
|---|---|---|---|
| target | string | required | Destination hostname (e.g. example.com) or IPv4/IPv6 address. Protocol prefixes are automatically stripped. |
| tester_ids | array<int> | optional | Array of 1 to 8 enabled tester node IDs. If omitted, automatically probes from all enabled tester nodes. |
| stream | boolean | optional | Set to true (or send Accept: text/event-stream) for progressive SSE output. |
curl -b cookies.txt -X POST https://cmonitor.realkia.com/api/vless/net-tools/ping \
-H "Content-Type: application/json" \
-d '{"target":"1.1.1.1"}'
{
"ok": true,
"results": [
{
"tester_id": 1,
"tester_name": "Master local (DE)",
"ok": true,
"round_trip_ms": 42,
"result": {
"ok": true,
"resolved_ip": "1.1.1.1",
"sent": 4,
"received": 4,
"loss_percent": 0.0,
"min_ms": 1.2,
"avg_ms": 1.35,
"max_ms": 1.5,
"probes": [1.2, 1.4, 1.3, 1.5],
"target_info": {
"country": "US",
"city": "San Francisco",
"isp": "Cloudflare, Inc.",
"asn": 13335,
"prefix": "1.1.1.0/24"
}
}
}
]
}
port property or inside target as host:port (e.g. example.com:443 or [2606:4700:4700::1111]:443).
Request Body
| Field | Type | Requirement | Description |
|---|---|---|---|
| target | string | required | Target hostname, IP, or host:port string. |
| port | integer | optional* | Destination port (1-65535). Required only if not included in target. |
| tester_ids | array<int> | optional | Array of 1 to 8 enabled tester node IDs. Defaults to all enabled nodes if omitted. |
curl -b cookies.txt -X POST https://cmonitor.realkia.com/api/vless/net-tools/tcp \
-H "Content-Type: application/json" \
-d '{"target":"cmonitor.realkia.com:443"}'
{
"ok": true,
"results": [
{
"tester_id": 1,
"tester_name": "Master local",
"ok": true,
"round_trip_ms": 18,
"result": {
"ok": true,
"resolved_ip": "89.58.29.206",
"latency_ms": 12.4,
"target_info": {
"country": "DE",
"city": "Frankfurt",
"isp": "Hetzner Online GmbH",
"asn": 24940,
"prefix": "89.58.0.0/17"
}
}
}
]
}
curl -b cookies.txt https://cmonitor.realkia.com/api/vless/net-tools/nodes
curl -b cookies.txt "https://cmonitor.realkia.com/api/vless/ip-search?ip=89.58.29.206"
β‘ Quick Check (Ephemeral Probes)
On-demand proxy verification that tests single configuration links or entire subscription feeds across chosen tester nodes without writing to the database or affecting monitoring history.
vless://, vmess://, trojan://, ss://, hysteria2://, wg:// WireGuard, socks5://, http(s):// proxies) across 1 to 8 selected tester nodes. Pass "speed_test": {"download": true, "upload": true, "bytes": 10485760, "max_seconds": 3} to measure tunnel throughput with customizable timeout cutoffs (e.g. 2s, 3s, 5s) and download/upload sizes (rate limited to 6 RPM per API key; cannot combine with check_method: "download").
curl -H "Authorization: Bearer cmon_YOUR_KEY" -X POST https://cmonitor.realkia.com/api/vless/quick-check \
-H "Content-Type: application/json" \
-d '{"url":"vless://UUID@domain:443?type=tcp&security=tls#Example","tester_ids":[1,3],"core":"auto","speed_test":{"download":true,"upload":true,"bytes":10485760}}'
speed_test (capped at 10 configs per run and 10 MB per direction; rate limited to 6 RPM per API key).
π Monitored Configurations (V2Ray / VLESS)
Continuous proxy monitoring endpoints with 1-hour rolling metrics, uptime ratios, bucketed time-series charts, and immediate refresh controls.
curl -b cookies.txt "https://cmonitor.realkia.com/api/vless?chart=0"
hours (1 to 168) and pts (default 180).
π¦ Subscriptions & Fleet Management
POST /api/subscriptions/:id/refresh.
GET /api/public/status/:slug without authentication.
π API Keys & Automation
Scoped API access for external repair scripts, monitoring daemons, and AI assistants. Keys are tied to your account, hashed with SHA-256 (only a one-way fingerprint is stored), and can be disabled or deleted immediately.
cmon_a1b2...7f2c), level, allowed groups, status, last used date, and 7-day error count. Plaintext secrets are never returned.read_only, read_test, or full. Optionally limit access to specific group IDs, set a request-per-minute cap, or set an expiry date.curl -X POST https://cmonitor.realkia.com/api/api-keys \
-H "Authorization: Bearer cmon_your_existing_key" \
-H "Content-Type: application/json" \
-d '{"name":"Auto Fixer","level":"read_test","rate_limit_rpm":60}'
π Webhooks & Change Alerts
Monitor configuration health state transitions and receive automated HTTP webhook callbacks when nodes go down (after failing N times consecutively) and when they recover.
good, bad, or unknown across all groups or filtered by key group permissions.{
"total": 35, "good": 32, "bad": 2, "unknown": 1,
"groups": [
{ "id": 1, "name": "Default", "total": 20, "good": 19, "bad": 1, "unknown": 0 }
]
}
"Config X went from good to bad at 2026-10-27 19:15:00 UTC (failed 3 times in a row: Connection refused)" and "Config X recovered (latency: 145ms)"). Query parameters: limit (1β200, default 50) and since (unix timestamp).POST /api/webhooks (create), PUT /api/webhooks/:id (edit), DELETE /api/webhooks/:id (delete), and POST /api/webhooks/:id/test (send test delivery).π Monitoring Integrations
Pull CMonitor data into Prometheus, Uptime Kuma, BetterStack or any web page. /metrics and /status-check/:id use your normal CMonitor username and password with HTTP Basic auth (repeated failures are throttled). Badges and public check URLs need no login and only expose what the public status page already shows.
tester_ids on POST/PUT /api/vless; the first node also drives alerts), and every node gets its own row of bars. ?range=24h|7d|30d|90d. Bars are [probes, ok, avg_ms] or null; green is under 1% failed probes, yellow under 20%, red above. GET /api/vless/:id/events returns the outage log (runs of 3 or more failed probes, last 7 days), and GET /api/vless/:id/chart?tester_id= returns one node's quality history.
429 with "code":"DOWNLOAD_LIMIT", and monitored download configs fall back to the connectivity check until the next month. Quick Check-only (metered) nodes never run download checks.
cmonitor_config_up, cmonitor_config_latency_ms, cmonitor_node_config_up, cmonitor_node_config_latency_ms, cmonitor_node_config_loss_ratio (5-minute window) and cmonitor_config_enabled, labeled by config, group, protocol, subscription and node. Configs without a probe in the last 3 minutes are left out rather than reported healthy. Admins may add ?user_id=. Optional Pushgateway export: set CMONITOR_PUSH_URL on the server.
scrape_configs:
- job_name: cmonitor
scheme: https
metrics_path: /metrics
basic_auth: { username: YOUR_USER, password: YOUR_PASSWORD }
static_configs: [{ targets: ["cmonitor.realkia.com"] }]
scrape_interval: 30s
200 OK when reachable, 503 when failed or without fresh data, 404 for unknown ids. Optional ?node=Name checks one tester, ?min_nodes=2 requires several nodes to reach it.
https://USER:PASSWORD@cmonitor.realkia.com/status-check/123?min_nodes=2
theme=dark|light, variant=default|flat|pill|dot, size=sm|md|lg, rounded, showName, showLatency, width, height. The matching /status/:slug/check/:id returns 200/503 for monitors. On a custom domain use /badge/:id.svg and /check/:id. Public pages also accept ?hideHeader=true&hideStats=true&hideControls=true&hideFooter=true&hideBackground=true for embedding.
 <img src="https://cmonitor.realkia.com/status/my-page/badge/123.svg?theme=light" alt="status">
π€ AI & Model Context Protocol (MCP)
CMonitor includes a built-in MCP stdio server allowing AI assistants (Claude, Windsurf, Cursor, ChatGPT) to interact with monitoring data and run network diagnostics safely.
Connecting an AI Client
Run node /opt/cmonitor/mcp/server.js (or npm run mcp) in your AI client's MCP configuration with the following environment variables:
export CMONITOR_MCP_URL=https://cmonitor.realkia.com export CMONITOR_MCP_USERNAME=your_username export CMONITOR_MCP_PASSWORD='your_password'
Available MCP tools include: net_ping, net_tcp, get_network_nodes, search_ip, quick_check_config, quick_check_subscription, list_v2ray_nodes, get_quality_history, and get_tester_health. For full MCP instructions visit /mcp.