To send data to Ubidots devices and variables over CoAP, every request must include an authentication token. This token uniquely identifies your account and authorizes the data you publish.
Ubidots uses a single query parameter for authentication in CoAP:
?token=<YOUR_TOKEN>This token must be appended to the resource path in every POST request you send to coap.ubidots.com/iot/devices/.
Obtaining your Ubidots Token
You can find your account token in the "My Profile" section of your Ubidots account:
- Log in to industrial.ubidots.com
- Expand the "My Profile" drop-down menu
- Locate the API Token under the API Credentials section
Your device includes this token in its CoAP requests.
Using the Token in CoAP Requests
When sending data to a device or a variable, include your token as a query parameter appended to the resource path. For example:
coap://coap.ubidots.com/iot/devices/<device_label>?token=<TOKEN>coap://coap.ubidots.com/iot/devices/<device_label>/<variable_label>/values?token=<TOKEN>Your CoAP POST message then contains the payload you want to publish (a compact JSON object with your variables).
Payload example:
{
"temperature": 25,
"humidity": 80
}{
"value": 25
}{
"value": 25
}With this setup, the device is authenticated and authorized to publish data to your Ubidots account.

