API Reference
Overview
Xray Checker provides both public and protected HTTP endpoints. Protected endpoints require authentication when METRICS_PROTECTED=true.
Public Endpoints
These endpoints are always accessible without authentication.
Health Check
GET /healthSimple health check endpoint.
Response: 200 OK with body OK
Public Proxy Status
GET /api/v1/public/proxiesReturns proxy status without sensitive data (no server IPs/ports). Used by the web UI for auto-refresh.
Response:
{ "success": true, "data": [ { "stableId": "a1b2c3d4e5f67890", "name": "US-Server-1", "online": true, "latencyMs": 150 } ]}Protected Endpoints
When METRICS_PROTECTED=true, these endpoints require Basic Authentication.
Web Interface
GET /HTML dashboard with proxy status overview, search, filtering, sorting, and auto-refresh.
Prometheus Metrics
GET /metricsPrometheus metrics endpoint.
Example metrics:
# HELP xray_proxy_status Status of proxy connection (1: success, 0: failure)# TYPE xray_proxy_status gaugexray_proxy_status{protocol="vless",address="example.com:443",name="proxy1",sub_name="Premium VPN"} 1
# HELP xray_proxy_latency_ms Latency of proxy connection in milliseconds# TYPE xray_proxy_latency_ms gaugexray_proxy_latency_ms{protocol="vless",address="example.com:443",name="proxy1",sub_name="Premium VPN"} 156Individual Proxy Status
GET /config/{stableId}Status endpoint for individual proxy, perfect for uptime monitoring.
Parameters:
stableId: 16-character stable identifier hash for the proxy
Response:
200 OKwith bodyOKif proxy is working503 Service Unavailablewith bodyFailedif proxy is not working
List All Proxies
GET /api/v1/proxiesReturns full information for all proxies.
Response:
{ "success": true, "data": [ { "index": 0, "stableId": "a1b2c3d4e5f67890", "name": "US-Server-1", "subName": "Premium VPN", "server": "192.168.1.1", "port": 443, "protocol": "vless", "proxyPort": 10000, "online": true, "latencyMs": 150 } ]}Get Proxy by ID
GET /api/v1/proxies/{stableId}Returns information for a specific proxy.
Response: Same structure as single item from /api/v1/proxies
System Status
GET /api/v1/statusReturns summary statistics.
Response:
{ "success": true, "data": { "total": 10, "online": 8, "offline": 2, "avgLatencyMs": 200 }}Configuration
GET /api/v1/configReturns current checker configuration.
Response:
{ "success": true, "data": { "checkInterval": 300, "checkMethod": "ip", "timeout": 30, "startPort": 10000, "subscriptionUpdate": true, "subscriptionUpdateInterval": 300, "simulateLatency": true, "subscriptionNames": ["Premium VPN", "Basic VPN"] }}System Info
GET /api/v1/system/infoReturns version and uptime information.
Response:
{ "success": true, "data": { "version": "1.0.0", "uptime": "1h 30m 45s", "uptimeSec": 5445, "instance": "prod-1" }}Current IP
GET /api/v1/system/ipReturns the server’s current detected IP address.
Response:
{ "success": true, "data": { "ip": "203.0.113.1" }}API Documentation
GET /api/v1/docsSwagger UI for interactive API documentation.
GET /api/v1/openapi.yamlOpenAPI specification file.
Authentication
When enabled (METRICS_PROTECTED=true), protected endpoints require Basic Authentication:
curl -u username:password http://localhost:2112/metricsNote: Public endpoints (/health, /api/v1/public/proxies) never require authentication.
Integration Examples
Uptime Kuma
# Monitor URL (use stableId from web UI or API)http://localhost:2112/config/a1b2c3d4e5f67890
# With authenticationhttp://username:password@localhost:2112/config/a1b2c3d4e5f67890Prometheus
scrape_configs: - job_name: "xray-checker" metrics_path: "/metrics" basic_auth: username: "username" password: "password" static_configs: - targets: ["localhost:2112"]Error Responses
All API endpoints return consistent error format:
{ "success": false, "error": "Error message"}HTTP Status Codes:
200 OK: Request successful400 Bad Request: Invalid parameters401 Unauthorized: Authentication required404 Not Found: Resource not found500 Internal Server Error: Server error503 Service Unavailable: Proxy check failed