This endpoint allows you to send one or more values to a specific variable inside a device. All CoAP requests must be made using the POST method and must include your Ubidots token as a query parameter.
Endpoint
| Protocol | Endpoint | Port |
|---|---|---|
| CoAP | coap.ubidots.com | 5684 |
Full URL
coap://coap.ubidots.com/iot/devices/<device_label>/<variable_label>/values?token=<TOKEN>Where:
<device_label>is the label of the device receiving the data<variable_label>is the label of the variable you want to update<TOKEN>is your Ubidots account token
Payload Format
The payload must be encoded as JSON. Ubidots accepts the same value formats as the REST API, including simple values, full Dot objects, arrays of Dots, and position updates.
Examples of valid payloads
Single value
{
"value": 25
}{
"value": 25,
"timestamp": 1712851200000,
"context": {
"unit": "C"
}
}[
{ "value": 10, "timestamp": 1712851200000 },
{ "value": 20, "timestamp": 1712851260000 }
]{
"value": 1,
"context": {
"lat": 6.5467,
"lng": -76.8765
}
}Query Parameters
Only one query parameter is required:
| Parameter | Type | Description |
|---|---|---|
token | String | Ubidots authentication token |
The timestamp and context must be included inside the payload itself (per Dot), not as query parameters.
Example
If you want to verify your CoAP setup or send test payloads before implementing them in your variable, the coap-client utility provides an easy way to make POST requests from the command line:
coap-client \
-m post \
-e '{"value": 25}' \
"coap://coap.ubidots.com/iot/devices/my-device-label/my-variable_label/values?token=BBFF-your_token_here"Notes
- CoAP messages must be sent as POST requests.
- Ubidots uses the reception time as the timestamp if none is provided.
- The maximum payload size depends on your device’s CoAP stack and network MTU, but keeping payloads compact is recommended.
