Sensorclouds
API Access

Using Your API Key

Authentication, endpoints, parameters, responses, and errors for the external REST API

Authentication

Send the key on every request, in one of these headers:

X-API-Key: YOUR_API_KEY
Authorization: Bearer YOUR_API_KEY
Authorization: ApiKey YOUR_API_KEY

The API Keys page has a Use your key panel with a ready-to-copy test command for your host.

Pagination

List endpoints accept page (default 1) and limit (default 50, maximum 200), and return:

{
  "data": [ … ],
  "meta": { "total": 128, "page": 1, "limit": 50, "totalPages": 3 }
}

Endpoints

List devices

GET /api/v1/devices?page=1&limit=50 · scope devices:read

curl "https://<host>/api/v1/devices?limit=2" -H "X-API-Key: YOUR_API_KEY"
{
  "data": [
    {
      "id": "5d8e…",
      "name": "Truck 12",
      "description": "Reefer unit",
      "applicationId": "a91c…",
      "firmwareVersion": "2.1.0",
      "connectionStatus": "ONLINE",
      "lastSeen": "2026-09-18T07:29:55.000Z",
      "location": null,
      "createdAt": "2026-03-02T04:10:00.000Z",
      "updatedAt": "2026-09-18T07:29:55.000Z"
    }
  ],
  "meta": { "total": 128, "page": 1, "limit": 2, "totalPages": 64 }
}

List alarm rules

GET /api/v1/alarms?page=1&limit=50 · scope alarms:read

Returns rules (not fired instances): id, name, description, applicationId, deviceId, field, operator, threshold, duration, cooldownMinutes, severity, enabled, createdAt, updatedAt.

Latest readings for a device

GET /api/v1/telemetry/devices/{deviceId}/latest · scope telemetry:read

{
  "deviceId": "5d8e…",
  "deviceName": "Truck 12",
  "lastSeen": "2026-09-18T07:29:55.000Z",
  "status": "ONLINE",
  "data": { "temperature": 4.2, "humidity": 61 },
  "timestamp": "2026-09-18T07:29:55.000Z"
}

History of one field

GET /api/v1/telemetry/devices/{deviceId}/history · scope telemetry:read

ParameterRequiredExampleMeaning
fieldYestemperatureThe field to read
timeRangeNo-24h, -7dA relative window
from, toNoISO 8601An exact window (instead of timeRange)
curl "https://<host>/api/v1/telemetry/devices/5d8e…/history?field=temperature&timeRange=-24h" \
  -H "Authorization: Bearer YOUR_API_KEY"
[
  { "timestamp": "2026-09-18T07:29:55.000Z", "value": 4.2 },
  { "timestamp": "2026-09-18T07:28:55.000Z", "value": 4.3 }
]

The API returns raw readings. It isn't summarized like dashboards and exports. History is limited to your plan's retention window.

If the key is limited to specific applications, the device must belong to one of them, or the request returns 403.

Errors

StatusMeaningFix
401Missing, invalid, revoked, or expired keyCheck the header and the key
403The key lacks the scope, or the device is outside its application scopeAdd the scope, or widen application access
404The device doesn't exist in your workspaceCheck the ID
429Too many requestsSlow down and retry with back-off

Example: export yesterday's readings to CSV (Python)

import csv, requests

HOST, KEY, DEVICE = "https://<host>", "YOUR_API_KEY", "5d8e…"
r = requests.get(f"{HOST}/api/v1/telemetry/devices/{DEVICE}/history",
                 params={"field": "temperature", "timeRange": "-24h"},
                 headers={"X-API-Key": KEY}, timeout=30)
r.raise_for_status()

with open("temperature.csv", "w", newline="") as f:
    w = csv.writer(f)
    w.writerow(["timestamp", "temperature"])
    for p in r.json():
        w.writerow([p["timestamp"], p["value"]])

Next Steps

On this page