Device APIs
Send telemetry and attributes from devices over MQTT, HTTP, CoAP, LwM2M and SNMP, and find the REST API reference.
Replace <token> with the device's access token.
MQTT
Connect with user name = access token (no password), or with MQTT basic / X.509 credentials.
| Topic | Direction | Payload |
|---|---|---|
v1/devices/me/telemetry | device → server | {"temperature":24.5} or {"ts":1730000000000,"values":{...}} or an array of those |
v1/devices/me/attributes | device → server | client attributes {"firmware":"1.2"} |
v1/devices/me/attributes | server → device (subscribe) | shared attribute changes |
v1/devices/me/attributes/request/<id> / .../response/<id> | both | request current attribute values |
v1/devices/me/rpc/request/+ | server → device (subscribe) | {"method":"setValue","params":...}; answer on v1/devices/me/rpc/response/<id> |
v1/devices/me/rpc/request/<id> | device → server | client-side RPC |
v1/gateway/connect, v1/gateway/telemetry, v1/gateway/attributes, v1/gateway/rpc | gateway | many devices through one gateway connection |
v1/devices/me/claim, /provision | device | claiming and provisioning |
Sparkplug B: enable it in the MQTT device profile (Sparkplug); metrics become telemetry and attributes of the edge node and its devices.
HTTP
| Request | Does |
|---|---|
POST /api/v1/<token>/telemetry | Telemetry (same JSON as MQTT) |
POST /api/v1/<token>/attributes | Client attributes |
GET /api/v1/<token>/attributes?clientKeys=a&sharedKeys=b | Read attributes |
GET /api/v1/<token>/rpc?timeout=20000 | Long-poll for a server-side RPC |
POST /api/v1/<token>/rpc/<id> | RPC answer |
CoAP
coap://<host>/api/v1/<token>/telemetry (POST), .../attributes, .../rpc; port 5683/udp, DTLS 5684.
LwM2M and SNMP
LwM2M devices are described by object models (XML) uploaded as resources and selected in the LwM2M device profile, which maps resources to telemetry and attributes. SNMP devices are polled by the server; the SNMP device profile lists OIDs, their keys and polling periods.
REST API
The server's REST API (entities, telemetry queries, RPC from applications) is documented at /swagger-ui/index.html on the backend. Authenticate with POST /api/auth/login (JWT) or an API key (X-Authorization: ApiKey <key>). The companion service's APIs are under /api/water/v1/... and /api/hub/... (see nexus-services/README.md).