Arduino IoT Cloud API 2.0 - Publish property value not working?


I succesfully setup an MKR Board with Arduino Cloud. The MKR should simply control a relay and has several properties. If i setup a dashboard with e.g. a button everything works as expected and I can control and visualize the relay using the dashboard.

I want to create a simple android app implementing a button for controlling the MKR. Maybe I did not understand the Arduino IoT Cloud API but it is possible to set property values using the API? I tried publish property endpoint:

curl --location --request PUT '<thingId>/properties/<propertyId>/publish' \
--header 'Content-Type: application/json' \
--header 'Authorization: <token>' \
--data-raw '{
    "device_id": "which_device_id?",
    "value": "false"

It seems that if I “show” the property afterwards the “last_value” attribute has been changed to the “published” value. But attached device/MKR does basically nothing? I simply want to switch the relay using the API.

Can you give me a hint what I am doing wrong?


Best Regards,

hi @dakmord

When you have a running board properties pushed through the API should get updated in a matter of 1 second, we do this all the time.

Would you mind sharing your sketch?
In the meantime I'll share this post with one of my colleagues who has been more active on the API than I have :slight_smile:

curl --request PUT '' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_BEARER_TOKEN' \
-d '{"value":"YOUR_VALUE"}'

In this case, you don't need the label "device_id" (you can find your device ID using APIs or just go on your Thing, click on "Associated Device")

If your value is a number, you can also remove the double quotes (so the API payload becomes -d '{"value":NUMBER}' )

Hello everyone,

thanks for the hint about removing double quotes for value. The property is a boolean. Seems that API accepts the “Strings” provided (HTTP 200) but does not process it.

Now works without double quotes:

--data-raw '{
    "value": true


--data-raw '{
    "value": 1

I was just confused because endpoint always responds with HTTP 200. Means that basically body json is not validated against property data types.