# Adding devices to groups via Cumulocity IOT api

**URL:** <https://community.cumulocity.com/t/adding-devices-to-groups-via-cumulocity-iot-api/1481>\
**Category:** Forum\
**Tags:** cumulocity\
**Created:** [October 6, 2022, 2:56am UTC](https://community.cumulocity.com/t/adding-devices-to-groups-via-cumulocity-iot-api/1481 "2022-10-06T02:56:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Cassidy](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@Michael\_Cassidy](https://community.cumulocity.com/u/Michael_Cassidy)\
**Post date:** [October 6, 2022, 2:56am UTC](https://community.cumulocity.com/t/adding-devices-to-groups-via-cumulocity-iot-api/1481/1 "2022-10-06T02:56:22Z")

</div>

Hi, I need to be able to add devices/assets to groups dynamically via internal API, this feature is not in the API documents, is there a way to find the correct methodology or can you point me in the right direction.

Thank you

---

<div class="post-metadata">

**Author:** ![Harald\_Meyer](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/harald_meyer/32/1959_2.png) [@Harald\_Meyer](https://community.cumulocity.com/u/Harald_Meyer)\
**Post date:** [October 6, 2022, 5:33am UTC](https://community.cumulocity.com/t/adding-devices-to-groups-via-cumulocity-iot-api/1481/2 "2022-10-06T05:33:47Z")

</div>

Hi Michael,

there is no specific API for this because groups, just like devices & assets are managed objects, so you can use that API:  
[https://cumulocity.com/api/10.14.0/#tag/Managed-objects](https://cumulocity.com/api/10.14.0/#tag/Managed-objects)

For a managed object to be a group it has to have the type c8y\_DeviceGroup (if it is a root) or c8y\_DeviceSubGroup. To add a device to a group, you have to use the child asset API on the group managed object:  
[https://cumulocity.com/api/10.14.0/#operation/postManagedObjectChildAssetsResource](https://cumulocity.com/api/10.14.0/#operation/postManagedObjectChildAssetsResource)

Best regards,  
Harald

---

<div class="post-metadata">

**Author:** ![Michael\_Cassidy](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@Michael\_Cassidy](https://community.cumulocity.com/u/Michael_Cassidy)\
**Post date:** [October 7, 2022, 5:40am UTC](https://community.cumulocity.com/t/adding-devices-to-groups-via-cumulocity-iot-api/1481/3 "2022-10-07T05:40:38Z")

</div>

Thank you Mr Meyer, greatly appreciate the help

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/system/32/31990_2.png) [@system](https://community.cumulocity.com/u/system)\
**Post date:** [April 5, 2023, 5:40am UTC](https://community.cumulocity.com/t/adding-devices-to-groups-via-cumulocity-iot-api/1481/4 "2023-04-05T05:40:41Z")

</div>

Closed on April 5, 2023, 5:40am UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
