API Reference
Available Endpoints
Xray Checker provides several HTTP endpoints for monitoring and status checking:
Health Check Endpoint
GET /healthSimple health check endpoint that returns HTTP 200 if the service is running.
Response:
- Status:
200 OK - Body:
OK
Metrics Endpoint
GET /metricsPrometheus metrics endpoint providing detailed proxy status and latency information.
Response:
- Status:
200 OK - Content-Type:
text/plain; version=0.0.4
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"} 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"} 156Proxy Status Endpoint
GET /config/{index}-{protocol}-{server}-{port}Individual proxy status endpoint, perfect for uptime monitoring.
Parameters:
index: Proxy index numberprotocol: Protocol type (vless/vmess/trojan/shadowsocks)server: Server addressport: Server port
Response:
- Status:
200 OKif proxy is working - Status:
503 Service Unavailableif proxy is not working - Body:
OKorFailed
Example:
# Check specific proxy statuscurl http://localhost:2112/config/0-vless-example.com-443Web Interface
GET /Returns the HTML dashboard with proxy status overview.
Authentication
When enabled (METRICS_PROTECTED=true), endpoints are protected with Basic Authentication:
- Username: Configured via
METRICS_USERNAME - Password: Configured via
METRICS_PASSWORD
Example with authentication:
curl -u username:password http://localhost:2112/metricsIntegration Examples
Uptime Kuma
# Add monitor with URLhttp://localhost:2112/config/0-vless-example.com-443
# Add authentication if enabledhttp://username:password@localhost:2112/config/0-vless-example.com-443Prometheus
scrape_configs: - job_name: "xray-checker" metrics_path: "/metrics" basic_auth: username: "username" password: "password" static_configs: - targets: ["localhost:2112"]Error Responses
The API returns standard HTTP status codes:
200 OK: Request successful401 Unauthorized: Authentication required403 Forbidden: Authentication failed404 Not Found: Endpoint or proxy not found503 Service Unavailable: Proxy check failed