Device Ingestion API

EndpointPOST
AuthTokenX-Device-Token header
Modules0

Telemetry Ingestion Endpoint

Devices send sensor readings via HTTPS POST. Each request is authenticated by the device's unique 64-character hex token, processed through the alert engine, and stored in the telemetry database.

📡 POST /api/telemetry/ingest

Headers: X-Device-Token: <64-char-hex-token> Content-Type: application/json Body: { "module": "health|vehicle|factory|home_infra|worker|fleet", "ts": 1700000000, "lat": 17.385044, "lng": 78.486671, "battery": 85, "signal": -67, "metrics": { "systolic": 178, "diastolic": 110, "heart_rate": 122, "spo2": 89, "temperature": 37.2 }, "flags": { "fall_detected": false, "panic_pressed": false } } Response (200): { "status": "ok", "ts": 1700000000 } Response (401): { "status": "error", "message": "Invalid device token", "code": 401 }

Module-Specific Payload Examples

ModuleMetricsFlags
healthsystolic, diastolic, heart_rate, spo2, temperature, glucosefall_detected, panic_pressed
vehiclespeed_kmh, heading, fuel_levelimpact_detected, impact_g_force, geofence_breach
factorygas_ppm, gas_type, temperature, humidity, smoke_levelfire_detected
home_infratemperaturewater_leak, power_failure, high_temperature
workerstepsfall_detected, panic_pressed, inactivity
fleetspeed_kmh, fuel_levelgeofence_breach

📦 Ingestion Pipeline

1. Validate device token → 2. Insert into telemetry_logs → 3. Upsert device_metrics_latest → 4. Update device status → 5. Insert GPS if present → 6. Insert module event → 7. Run alert engine → 8. Return {"status":"ok"}