Use this endpoint to send data to one or more variables of a device in a single CoAP request. This is useful when your device measures several parameters at once and you want to update multiple variables with a single payload.
Endpoint
| Protocol | Endpoint | Port |
|---|---|---|
| CoAP | coap.ubidots.com | 5684 |
Full URL
coap://coap.ubidots.com/iot/devices/<device_label>?token=<TOKEN>Where:
<device_label>is the label of the device you want to update<TOKEN>is your Ubidots account token
All requests must be sent using the POST method.
Payload Format
The payload must be a JSON object where each key represents a variable label and each value represents a Dot or a simple numeric value.
Examples of valid payloads
{
"temperature": 25,
"humidity": 80
}{
"temperature": {
"value": 25,
"timestamp": 1712851200000
},
"humidity": {
"value": 80,
"context": {
"unit": "%"
}
}
}{
"temperature": [
{ "value": 10, "timestamp": 1712851200000 },
{ "value": 11, "timestamp": 1712851260000 }
],
"humidity": [
{ "value": 90, "timestamp": 1712851200000 },
{ "value": 92, "timestamp": 1712851260000 }
]
}{
"position": {
"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 device, the coap-client utility provides an easy way to make POST requests from the command line:
coap-client \
-m post \
-e '{"temperature": 25, "humidity": 80}' \
"coap://coap.ubidots.com/iot/devices/my-device-label?token=BBFF-your_token_here"Notes
- If no timestamp is provided, Ubidots applies the reception time automatically.
- All timestamps must be in POSIX milliseconds.
- The payload should remain compact to avoid fragmentation at the UDP/CoAP layer.
- This endpoint automatically creates variables if they do not exist yet, using the keys from your payload.
