Skip to content

REST API: System Telemetry, AI Models & Backup Endpoints ​

The System API exposes engine telemetry, runtime memory allocations, live log streams, AI model distribution, and database backup utilities.


1. System Runtime Statistics (GET /api/stats) ​

Returns real-time Go runtime memory, active goroutines, network throughput, and stream counts:

  • Required Role: viewer, operator, or admin
bash
curl -H "Authorization: Bearer <TOKEN>" http://localhost:8080/api/stats

Response (200 OK):

json
{
  "version": "1.0.0",
  "uptime_sec": 172800,
  "uptime": "48h0m0s",
  "memory_alloc_mb": 140.5,
  "total_alloc_mb": 2500.2,
  "sys_memory_mb": 2224.0,
  "num_gc": 7903,
  "goroutines": 2448,
  "active_streams": 600,
  "total_cameras": 600,
  "total_fps": 18139.0,
  "total_bitrate_kbps": 1339900,
  "active_recordings": 600
}

2. Real-Time Log Stream via SSE (GET /api/logs/stream) ​

Streams live structured JSON logs using Server-Sent Events (SSE):

  • Required Role: operator or admin
bash
curl -N -H "Authorization: Bearer <ADMIN_TOKEN>" http://localhost:8080/api/logs/stream

3. Database Backup & Restore Endpoints ​

3.1 Export Snapshot (GET /api/system/backup/export) ​

Downloads a complete JSON snapshot containing all cameras, tags, folders, and users:

  • Required Role: admin
bash
curl -H "Authorization: Bearer <ADMIN_TOKEN>" \
  http://localhost:8080/api/system/backup/export > ruseon_backup_$(date +%Y%m%d).json

3.2 Restore Snapshot (POST /api/system/backup/import) ​

Restores full system state from a JSON backup:

bash
curl -X POST http://localhost:8080/api/system/backup/import \
  -H "Authorization: Bearer <ADMIN_TOKEN>" \
  -H "Content-Type: application/json" \
  -d @ruseon_backup_20260823.json

Response (200 OK): {"message": "backup restored successfully"}.


4. AI Model Distribution Hub (GET /models/:filename) ​

Serves ONNX neural network weights (e.g. yolo11n.onnx, yolo11s.onnx, yolo11m.onnx) with local disk caching in data/models/ and singleflight deduplication:

bash
curl -O http://localhost:8080/models/yolo11s.onnx

Released under the MIT License.