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
| Module | Metrics | Flags |
|---|---|---|
| health | systolic, diastolic, heart_rate, spo2, temperature, glucose | fall_detected, panic_pressed |
| vehicle | speed_kmh, heading, fuel_level | impact_detected, impact_g_force, geofence_breach |
| factory | gas_ppm, gas_type, temperature, humidity, smoke_level | fire_detected |
| home_infra | temperature | water_leak, power_failure, high_temperature |
| worker | steps | fall_detected, panic_pressed, inactivity |
| fleet | speed_kmh, fuel_level | geofence_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"}