Remove a device from Device group using cloud API

I am trying to figure out how to remove or un-allocate a device from device group

My scenario is a device is part of multiple groups as an example “DeviceA” is part of “groupA” and “groupB”

I want to remove/un-allocate “DeviceA” from “groupA” using cloud API

Any pointer will be appreciated

The way to remove a device group is to get the list of device groups for a device, remove the element you want to remove, then set the device group list.

https://docs.particle.io/reference/device-cloud/api/#assign-groups-to-a-device

In other words, there’s no add/remove, only get/set and that sets all of the groups that the device belongs to. It could be an empty list as well.