Hi Emily, and welcome to the forums. I can’t say I have an answer for you, but maybe I can raise visibility for your question since no one has addressed it yet.
Could you clarify what purpose this is for? Is this to do some pseudo load balancing between groups? I assume there are groups that you don’t want included in this, so do the target groups have a naming convention? And the target devices would be devices that aren’t already in one of these groups?
Also - I don’t have any experience with this but I suspect if you want to do something like this it would have to be via the REST API. Perhaps someone with more knowledge can chime in. I found some hits on the forum here that also may be helpful: