Skip to main content

Telemetry

Query GPS and battery telemetry data from devices.

GPS Telemetry

Get GPS History

none
GET /devices/:id/gps
Get GPS telemetry history for a device.

Query Parameters

limit
number
default:"100"
Maximum records to return
from
string
ISO date string for start of range (requires to)
to
string
ISO date string for end of range (requires from)
# Latest 100 records
curl -H "X-API-Key: your-key" https://api.example.com/devices/ABC123/gps

# With limit
curl -H "X-API-Key: your-key" "https://api.example.com/devices/ABC123/gps?limit=50"

# Date range
curl -H "X-API-Key: your-key" \
  "https://api.example.com/devices/ABC123/gps?from=2025-12-01T00:00:00Z&to=2025-12-17T00:00:00Z"
[
  {
    "_id": "...",
    "device_id": "a1b2c3d4",
    "hardware_id": "ABC123",
    "timestamp": "2025-12-17T10:30:00.000Z",
    "lat": 37.7749,
    "long": -122.4194,
    "speed": 15.5
  }
]

Get Latest GPS

none
GET /devices/:id/gps/latest
Get the most recent GPS reading.
curl -H "X-API-Key: your-key" https://api.example.com/devices/ABC123/gps/latest
{
  "_id": "...",
  "device_id": "a1b2c3d4",
  "hardware_id": "ABC123",
  "timestamp": "2025-12-17T10:30:00.000Z",
  "lat": 37.7749,
  "long": -122.4194,
  "speed": 15.5
}
Errors: 404 if no GPS telemetry found

Battery Telemetry

Get Battery History

none
GET /devices/:id/battery
Get battery telemetry history for a device.

Query Parameters

limit
number
default:"100"
Maximum records to return
from
string
ISO date string for start of range (requires to)
to
string
ISO date string for end of range (requires from)
curl -H "X-API-Key: your-key" https://api.example.com/devices/ABC123/battery
[
  {
    "_id": "...",
    "device_id": "a1b2c3d4",
    "hardware_id": "ABC123",
    "timestamp": "2025-12-17T10:30:00.000Z",
    "battery_voltage": 12.4
  }
]

Get Latest Battery

none
GET /devices/:id/battery/latest
Get the most recent battery reading.
curl -H "X-API-Key: your-key" https://api.example.com/devices/ABC123/battery/latest
{
  "_id": "...",
  "device_id": "a1b2c3d4",
  "hardware_id": "ABC123",
  "timestamp": "2025-12-17T10:30:00.000Z",
  "battery_voltage": 12.4
}
Errors: 404 if no battery telemetry found

Telemetry Management

Get Telemetry Stats

none
GET /devices/:id/telemetry/stats
Get telemetry record counts for a device. Admin only 🔐
curl -H "X-API-Key: your-admin-key" \
  https://api.example.com/devices/ABC123/telemetry/stats
{
  "hardware_id": "ABC123",
  "gps": 3500,
  "battery": 1200
}

Purge Device Telemetry

none
DELETE /devices/:id/telemetry
Delete all telemetry for a device. Admin only 🔐
curl -X DELETE -H "X-API-Key: your-admin-key" \
  https://api.example.com/devices/ABC123/telemetry
{
  "success": true,
  "purged": {
    "gps": 3500,
    "battery": 1200
  }
}

Purge GPS Telemetry

none
DELETE /devices/:id/telemetry/gps
Delete GPS telemetry for a device. Admin only 🔐
curl -X DELETE -H "X-API-Key: your-admin-key" \
  https://api.example.com/devices/ABC123/telemetry/gps
{
  "success": true,
  "deleted": 3500
}

Purge Battery Telemetry

none
DELETE /devices/:id/telemetry/battery
Delete battery telemetry for a device. Admin only 🔐
curl -X DELETE -H "X-API-Key: your-admin-key" \
  https://api.example.com/devices/ABC123/telemetry/battery
{
  "success": true,
  "deleted": 1200
}