Skip to content

Cookie preferences

We use cookies for our own analytics, to see how our campaigns perform and, if you allow it, to load content from other services such as the Google site search. We never sell your data. Necessary cookies keep the site working and cannot be switched off. See our Cookie Policy for details and our Privacy Policy for how we handle personal data.

Security, load balancing and remembering your cookie choice.

Show us which pages people read, how they find the site and where they get stuck, so we can improve it (Google Analytics, Microsoft Clarity).

Show us which of our ad campaigns bring visitors to the site and remember the campaign or partner link you arrived from (Google Ads, LinkedIn, Meta, partner program). We do not use these cookies to build advertising profiles.

Load the site search from Google when you use it. Google sets its own cookies and shows ads in the search results.

© 2026 The ThingsBoard Authors
22.5k Try for free

ThingsBoard Cloud

Choose your data region

Your data stays in the region you choose, for residency and compliance. No credit card required.

Rather run it yourself? Install on your own servers

Attributes

The CoAP Attributes API lets devices upload client-side attributes, request attribute values, and subscribe to shared attribute updates using the CoAP Observe option. For an explanation of attribute types, see Attributes.

See Getting Connected for credential types and connection details.

Send a POST request to upload client-side attributes:

Credential type URL
Access Token coap(s)://THINGSBOARD_HOST/api/v1/$ACCESS_TOKEN/attributes
X.509 Certificate coaps://THINGSBOARD_HOST/api/v1/attributes
{"attribute1": "value1", "attribute2": true, "attribute3": 42.0}

Access Token:

Terminal window
coap-client -v 6 -m POST -t "application/json" -e '{"attribute1":"value1","attribute2":true,"attribute3":42.0}' "coap://$THINGSBOARD_HOST:5683/api/v1/$ACCESS_TOKEN/attributes"

X.509 Certificate:

Terminal window
coap-client-openssl -v 6 -c cert.pem -j key.pem -m POST -t "application/json" -e '{"attribute1":"value1","attribute2":true,"attribute3":42.0}' "coaps://$THINGSBOARD_HOST/api/v1/attributes"

Send a GET request with clientKeys and sharedKeys query parameters:

Credential type URL
Access Token coap(s)://THINGSBOARD_HOST/api/v1/$ACCESS_TOKEN/attributes?clientKeys=attr1,attr2&sharedKeys=shared1,shared2
X.509 Certificate coaps://THINGSBOARD_HOST/api/v1/attributes?clientKeys=attr1,attr2&sharedKeys=shared1,shared2

Access Token:

Terminal window
coap-client -v 6 -m GET "coap://$THINGSBOARD_HOST:5683/api/v1/$ACCESS_TOKEN/attributes?clientKeys=attribute1,attribute2&sharedKeys=shared1,shared2"

X.509 Certificate:

Terminal window
coap-client-openssl -v 6 -c cert.pem -j key.pem -m GET "coaps://$THINGSBOARD_HOST/api/v1/attributes?clientKeys=attribute1,attribute2&sharedKeys=shared1,shared2"

Response:

{"client": {"attribute1": "value1", "attribute2": true}, "shared": {"shared1": "value2", "shared2": false}}

When the device profile payload type is set to Protobuf, the request and response use fixed schemas. See MQTT Attributes for the Protobuf schemas.

Use the CoAP Observe option to receive push notifications when shared attributes change. The connection stays open and ThingsBoard sends a response each time a shared attribute is updated.

Credential type URL
Access Token coap(s)://THINGSBOARD_HOST/api/v1/$ACCESS_TOKEN/attributes/updates
X.509 Certificate coaps://THINGSBOARD_HOST/api/v1/attributes/updates

Access Token (observe for 60 seconds):

Terminal window
coap-client -v 6 -m GET -s 60 "coap://$THINGSBOARD_HOST:5683/api/v1/$ACCESS_TOKEN/attributes/updates"

X.509 Certificate:

Terminal window
coap-client-openssl -v 6 -c cert.pem -j key.pem -m GET -s 60 "coaps://$THINGSBOARD_HOST/api/v1/attributes/updates"

When a shared attribute changes, ThingsBoard pushes the updated values:

{"shared": {"firmware_version": "2.1.0"}}

When the device profile payload type is set to Protobuf, notifications use a fixed schema. See MQTT Attributes for the Protobuf schema.