Skip to main content

System

System endpoints for health monitoring and statistics.

Health Check

none
GET /health
Returns server health status. No authentication required.
curl https://api.example.com/health
{
  "status": "ok",
  "timestamp": "2025-12-17T10:30:00.000Z",
  "subscriptions": {
    "totalConnections": 5,
    "totalDevicesWatched": 12,
    "subscriptionsByDevice": {}
  }
}

System Stats

none
GET /stats
Returns system-wide statistics. Admin only 🔐
curl -H "X-API-Key: your-admin-key" https://api.example.com/stats
{
  "devices": 42,
  "telemetry": {
    "gps": 150000,
    "battery": 75000
  },
  "commands": 1200,
  "subscriptions": {
    "totalConnections": 5,
    "totalDevicesWatched": 12,
    "subscriptionsByDevice": {}
  }
}

Purge Old Telemetry

none
POST /telemetry/purge
Purge telemetry data older than specified days. Admin only 🔐

Request Body

older_than_days
number
required
Delete telemetry older than this many days
curl -X POST https://api.example.com/telemetry/purge \
  -H "X-API-Key: your-admin-key" \
  -H "Content-Type: application/json" \
  -d '{"older_than_days": 30}'
{
  "success": true,
  "cutoff_date": "2025-11-17T00:00:00.000Z",
  "purged": {
    "gps": 50000,
    "battery": 25000
  }
}