Authentication

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 into industrial.ubidots.com
  • Expand the "My Profile" drop-down menu
  • Locate the API Token under the API Credentials section

This token is what your device will include 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 will then contain the payload you wish to publish (a compact JSON 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.