API Documentation

Real-time monitoring API for DoubleZero network devices

https://api.s3rdv.com

Overview

🔍 Real-time Monitoring

Monitor device latency, status, and network health every 30 seconds

📊 Historical Data

Access 25 hours of historical data with trend analysis and statistics

🔔 Smart Alerts

Slack integration with intelligent alerting for device status changes

🌐 ASN Integration

Automatic ASN lookup and network provider identification

API Endpoints

GET /health
Basic health status and uptime information
curl https://api.s3rdv.com/health
{ "status": "healthy", "timestamp": "2025-07-26T16:58:24.123Z", "uptime": 86400, "memory": {...}, "version": "1.0.0" }
GET /health/detailed
Detailed health check with DoubleZero CLI status and system information
curl https://api.s3rdv.com/health/detailed
{ "status": "healthy", "timestamp": "2025-07-26T16:58:24.123Z", "uptime": 86400, "memory": {...}, "version": "1.0.0", "environment": "production", "nodeVersion": "v18.17.0", "platform": "linux", "doublezero": { "available": true, "version": "1.2.3" } }
GET /health/ready
Readiness probe for Kubernetes deployments
curl https://api.s3rdv.com/health/ready
{ "status": "ready", "timestamp": "2025-07-26T16:58:24.123Z" }
GET /health/live
Liveness probe for Kubernetes deployments
curl https://api.s3rdv.com/health/live
{ "status": "alive", "timestamp": "2025-07-26T16:58:24.123Z", "uptime": 86400 }
GET /api/devices
Get all device statuses with ASN, location, and historical data
curl https://api.s3rdv.com/api/devices
{ "success": true, "data": [ { "pubkey": "device_pubkey", "code": "fra-dz-001-x", "location": "Frankfurt", "type": "Switch", "public_ip": "192.168.1.1", "asn": "6453", "asn_name": "TATA Communications", "latency": 241, "latency_status": "online", "historical_stats": { "min": 241, "max": 242, "avg": 241.5, "trend": 0.5, "previous": 241, "observations": 3000 } } ], "timestamp": "2025-07-26T16:58:24.123Z" }
GET /api/stats
Get monitoring statistics and success rates
curl https://api.s3rdv.com/api/stats
{ "success": true, "data": { "totalObservations": 17200, "alertsSent": 12, "deviceCount": 20, "lastCheck": "2025-07-26T16:58:24.123Z", "startTime": "2025-07-26T00:00:00.000Z", "firstObservation": "2025-07-26T00:00:00.000Z", "lastObservation": "2025-07-26T16:58:24.123Z" }, "timestamp": "2025-07-26T16:58:24.123Z" }

Data Structures

Device Object

{ "pubkey": "string", // Device public key "code": "string", // Device code (e.g., "fra-dz-001-x") "location": "string", // Location name "type": "string", // Device type "public_ip": "string", // Public IP address "asn": "string", // ASN number "asn_name": "string", // ASN organization name "latency": number, // Current latency in milliseconds "latency_status": "string", // "online" or "Unreachable" "historical_stats": { // Historical statistics "min": number, // Minimum latency "max": number, // Maximum latency "avg": number, // Average latency "trend": number, // Trend percentage "previous": number, // Previous measurement "observations": number // Number of observations } }

Monitoring Stats Object

{ "totalObservations": number, // Total individual ping measurements across all devices "alertsSent": number, // Number of alerts sent "deviceCount": number, // Number of devices "lastCheck": "string", // Last check timestamp "startTime": "string", // Service start timestamp "firstObservation": "string", // First observation timestamp (when data collection started) "lastObservation": "string" // Last observation timestamp }

Features

📈 Historical Data

25 hours of historical data (3000 observations per device) with min/max/average statistics

🔍 Trend Analysis

Real-time trend calculation comparing recent vs previous measurements

🌐 ASN Lookup

Automatic ASN lookup using multiple APIs (RIPEstat, BGPView, IPAPI, PeeringDB)

🔔 Smart Alerts

Slack integration with intelligent alerting for device status changes and latency deviations

⚡ Real-time Updates

30-second monitoring intervals with immediate status updates

🛡️ Health Checks

Comprehensive health endpoints for Kubernetes deployments and monitoring

Rate Limiting

Current Limits

500 requests per 15 minutes per IP address

This limit is designed to accommodate dashboard auto-refresh (every 30 seconds) and manual API usage.

Authentication

Public API

Currently, the API is public and does not require authentication. Rate limiting is applied per IP address.