Skip to content
Stand with Ukraine flag

Device API

Devices connect to ThingsBoard Edge directly on the local network — not to the cloud server. Edge exposes the same device APIs as ThingsBoard CE on the same default ports. The only difference is the target host: devices use the Edge node’s IP address or hostname instead of the cloud server address.

Default ports: 1883 (plain), 8883 (TLS)

ParameterValue
HostEdge node hostname or IP
Port1883 (plain) or 8883 (TLS)
Client IDany unique string
Usernamedevice access token
Password(leave empty)
OperationDirectionTopic
Publish telemetryDevice → Edgev1/devices/me/telemetry
Publish attributesDevice → Edgev1/devices/me/attributes
Subscribe to shared attribute updatesEdge → Devicev1/devices/me/attributes
Request attributesDevice → Edgev1/devices/me/attributes/request/{requestId}
Receive attribute responseEdge → Devicev1/devices/me/attributes/response/{requestId}
Subscribe to server-side RPCEdge → Devicev1/devices/me/rpc/request/+
Send server-side RPC responseDevice → Edgev1/devices/me/rpc/response/{requestId}
Send client-side RPCDevice → Edgev1/devices/me/rpc/request/{requestId}
Receive client-side RPC responseEdge → Devicev1/devices/me/rpc/response/{requestId}
Claim deviceDevice → Edgev1/devices/me/claim
Provision deviceDevice → Edge/provision
Receive firmware chunkEdge → Devicev2/fw/response/+/chunk/+
Receive software chunkEdge → Devicev2/sw/response/+/chunk/+

For full payload schemas, protocol version options, Protobuf encoding, and Sparkplug B support, see the MQTT API reference.

Default ports: 8080 (plain), 443 (HTTPS)

Base URL: http://{EDGE_HOST}:8080/api/v1/{accessToken}

OperationMethodPath
Publish telemetryPOST/telemetry
Publish attributesPOST/attributes
Get attributesGET/attributes?clientKeys=…&sharedKeys=…
Subscribe to attribute updates (long-poll)GET/attributes/updates?timeout={ms}
Subscribe to RPC commands (long-poll)GET/rpc?timeout={ms}
Send RPC responsePOST/rpc/{requestId}
Claim devicePOST/claim
Provision devicePOSThttp://{EDGE_HOST}:8080/api/v1/provision
Get firmware infoGET/firmware?title={title}&version={ver}

For full payload schemas and provisioning flows, see the HTTP API reference.

Default ports: 5683 UDP (plain), 5684 UDP (DTLS)

CoAP uses the same operation paths as the HTTP API with coap://{EDGE_HOST}/ as the base URL. Confirmable (CON) messages are used by default; the observe option is used for subscriptions.

For the full CoAP topic reference and DTLS setup, see the CoAP API reference.

Default ports: 5685 CoAP, 5686 CoAP/DTLS, 5687 TCP, 5688 TCP/TLS

ThingsBoard implements the OMA LwM2M 1.0 and 1.1 specifications. Devices register via the standard LwM2M bootstrap or direct registration flow. Object and resource mappings, OTA update support, and RPC command encoding are described in the LwM2M API reference.

Default port: 161 UDP

Edge acts as an SNMP manager that polls devices on a configurable schedule. Devices do not connect to Edge — Edge polls them. For polling configuration and OID mapping, see the SNMP API reference.

Gateways connecting multiple devices use a separate MQTT topic namespace. Connect as a regular MQTT device using the access token as the username, then use the gateway topics to manage child devices.

OperationDirectionTopic
Connect child deviceGateway → Edgev1/gateway/connect
Disconnect child deviceGateway → Edgev1/gateway/disconnect
Publish telemetryGateway → Edgev1/gateway/telemetry
Publish attributesGateway → Edgev1/gateway/attributes
Subscribe to attribute updatesEdge → Gatewayv1/gateway/attributes
Request attributesGateway → Edgev1/gateway/attributes/request
Receive attribute responseEdge → Gatewayv1/gateway/attributes/response
Subscribe to RPC commandsEdge → Gatewayv1/gateway/rpc
Send RPC responseGateway → Edgev1/gateway/rpc

For the full gateway payload schemas, see the MQTT Gateway API reference and the MQTT Sparkplug B API reference.

The following SDKs implement the ThingsBoard device protocols and work against Edge without modification — set the host to your Edge node:

SDKLanguageProtocols
Python Device SDKPythonMQTT, HTTP
MicroPython Client SDKMicroPythonMQTT
CircuitPython Client SDKCircuitPythonMQTT
Arduino Client SDKC++ (Arduino)MQTT
Python Gateway SDKPythonMQTT (Gateway API)
ThingsBoard IoT GatewayJavaMQTT, Modbus, OPC-UA, BACnet, and others