We have commands in the api that are removing groups.
One thing that is good to know when you use them is that if you remove a group and replace it with a group that have the same name. The new group doesn't automatically get used on the same places where the old group was used.
For example. Here we have applied a group called apigroup4 to an activity:
This group has the id 62 (which you can see under administrate->usergroups
(hover the mouse over the group name to see the number)
Let's say now that you delete the group and add a new group on the same place with the same name.
The new group now gets a different id (in this case 97)
The old group is therefore gone from the applications to the activity. This is because the applications to the activities are based on the groupId, and this new group has another groupId.
Therefore. Be careful to check where the group is used before you delete the group.