Skip to content
Stand with Ukraine flag

RPC Commands

ThingsBoard executes LwM2M operations on devices via RPC commands. Send them from the REST API, a dashboard widget, or the RPC Debug Terminal. For a full explanation of the RPC model, see Command & Control.

Every LwM2M RPC command has two fields:

{
"method": "Read",
"params": {"id": "/3/0/9"}
}
FieldDescription
methodLwM2M operation name (see table below)
paramsTarget resource and additional options

Use either the resource path or a key defined in the device profile:

FormatExample
Resource path{"id": "/3/0/9"}
Path with object version{"id": "/3_1.2/0/9"}
Key{"key": "batteryLevel"}

In the RPC Debug Terminal omit the JSON wrapper — write Read {"id":"/3/0/9"} directly.

MethodInterfaceDescription
ReadDevice ManagementRead a resource, instance, or all object instances
DiscoverDevice ManagementList available resources on an object or instance
WriteUpdateDevice ManagementPartial update — change specified resources, leave others
WriteReplaceDevice ManagementReplace resource value(s) entirely
WriteAttributesDevice ManagementSet NOTIFICATION-class attributes (pmin, pmax, gt, lt, st)
ReadCompositeDevice ManagementRead multiple resources across different objects at once
WriteCompositeDevice ManagementWrite multiple resources across different objects atomically
ExecuteDevice ManagementTrigger an action (e.g., reboot, firmware install)
DeleteDevice ManagementDelete an Object Instance
ObserveInformation ReportingStart observing a resource for changes
ObserveCancelInformation ReportingCancel a single observation
ObserveCancelAllInformation ReportingCancel all observations on the device (ThingsBoard-specific)
ObserveReadAllInformation ReportingList all active observations (ThingsBoard-specific)
ObserveCompositeInformation ReportingObserve multiple resources in a single request
ObserveCompositeCancelInformation ReportingCancel a composite observation
DiscoverAllThingsBoard-specificReturn the full object/resource hierarchy of the client

Read the current value of a resource, instance, or all object instances.

{"method": "Read", "params": {"id": "/3/0/9"}}
# Terminal request:
Read {"id":"/3/0/9"}
# Response:
{"result":"CONTENT","value":"LwM2mSingleResource [id=9, value=100, type=INTEGER]"}

Read by key:

Read {"key":"batteryLevel"}

Read an entire object instance:

Read {"id":"/3/0"}

List the resources instantiated on an object or instance, returned as CoRE Link format.

{"method": "Discover", "params": {"id": "/3"}}
# Terminal:
Discover {"id":"/3"}
# Response:
{"result":"CONTENT","value":"</3>,</3/0/0>,</3/0/1>,</3/0/2>,..."}

Partially update resource values — unspecified resources are not changed.

{"method": "WriteUpdate", "params": {"id": "/3/0", "value": {"14": "+5", "15": "Europe/Kyiv"}}}
WriteUpdate {"id":"/3/0","value":{"14":"+5","15":"Europe/Kyiv"}}
# Response: {"result":"CHANGED"}

Replace a resource value entirely.

{"method": "WriteReplace", "params": {"id": "/19/0/0", "value": "0081"}}
WriteReplace {"id": "/19/0/0", "value": "0081"}
# Response: {"result":"CHANGED"}

Set NOTIFICATION-class attributes on a resource (pmin, pmax, gt, lt, st). See Data Model for attribute descriptions.

{"method": "WriteAttributes", "params": {"id": "/19/0/0", "attributes": {"pmax": 120, "pmin": 10}}}
WriteAttributes {"id":"/19/0/0","attributes":{"pmax":120,"pmin":10}}
# Response: {"result":"CHANGED"}

Read any combination of resources, instances, or objects in a single request. Non-atomic — resources without a valid value are omitted from the response.

{"method": "ReadComposite", "params": {"ids": ["/3/0/9", "/1_1.2"]}}
ReadComposite {"ids":["/3/0/9","/1_1.2"]}
# Response: {"result":"CONTENT","value":"{/3/0/9=LwM2mSingleResource [id=9, value=75, type=INTEGER], ...}"}

Read by keys:

ReadComposite {"keys":["batteryLevel","updateResult","pkgversion"]}

Write multiple resources across different objects atomically. All resources must be writable — the operation fails if any single write would fail.

{"method": "WriteComposite", "params": {"nodes": {"/19_1.1/0": {"0": {"0": "00ad45675600"}}, "/3_1.0/0/15": "Europe/Kyiv"}}}
WriteComposite {"nodes":{"/19_1.1/0":{"0":{"0":"00ad45675600"}},"UtfOffset":"+04","/3_1.0/0/15":"Europe/Kyiv"}}
# Response: {"result":"CHANGED"}

Trigger an action on the device. Can only target individual executable resources.

{"method": "Execute", "params": {"id": "/3/0/4"}}
Execute {"id":"/3/0/4"}
# Response: {"result":"CHANGED"}

Common execute targets:

PathAction
/3/0/4Reboot device
/5/0/2Trigger firmware update install
/1/0/8Registration Update Trigger
/1/0/9Bootstrap-Request Trigger

Delete an Object Instance. The mandatory Device Object (ID 3) cannot be deleted.

{"method": "Delete", "params": {"id": "/19/1"}}
Delete {"id":"/19/1"}
# Response: {"result":"DELETE"}

Subscribe to changes on a resource, instance, or object. ThingsBoard receives a notification each time the value changes.

{"method": "Observe", "params": {"id": "/3/0/9"}}
Observe {"id":"/3/0/9"}
# Response: {"result":"CONTENT","value":"LwM2mSingleResource [id=9, value=28, type=INTEGER]"}

End a specific observation relationship.

{"method": "ObserveCancel", "params": {"id": "/5/0/7"}}
ObserveCancel {"id":"/5/0/7"}
# Response: {"result":"CONTENT","value":"1"}

Observe multiple resources across different objects in a single request.

{"method": "ObserveComposite", "params": {"ids": ["/5/0/7", "/5/0/5", "/3/0/9"]}}
ObserveComposite {"ids":["/5/0/7","/5/0/5","/3/0/9"]}
# Response: {"result":"CONTENT","value":"{/5/0/7=..., /5/0/5=..., /3/0/9=...}"}

Cancel a previously established composite observation.

{"method": "ObserveCompositeCancel", "params": {"ids": ["/5/0/7", "/5/0/5", "/3/0/9"]}}
ObserveCompositeCancel {"ids":["/5/0/7","/5/0/5","/3/0/9"]}
# Response: {"result":"CONTENT","value":"1"}

ThingsBoard-specific. Cancel all observations on the device at once. Use before switching observe strategies.

{"method": "ObserveCancelAll", "params": {}}
ObserveCancelAll
# Response: {"result":"CONTENT","value":"8"} // 8 observations cancelled

ThingsBoard-specific. Return a list of all currently active observations on the device.

{"method": "ObserveReadAll", "params": {}}
ObserveReadAll
# Response: {"result":"CONTENT","value":"[\"/5/0/7\",\"/3/0/3\",\"/5/0/3\",\"/5/0/5\"]"}

ThingsBoard-specific. Return the full object and resource hierarchy of the connected client, built from the registration message. Does not send any request to the device — useful for troubleshooting and verifying object versions.

{"method": "DiscoverAll", "params": {}}
DiscoverAll
# Response: {"result":"CONTENT","value":"[{\"url\":\"/\",\"attributes\":{\"ct\":\"110\",\"rt\":\"\\\"oma.lwm2m\\\"\"}},{\"url\":\"/1\",\"attributes\":{\"ver\":\"1.1\"}},...]"}