API for changing category groups

Yes, everything in Discourse has an API. You can learn the API endpoints for stuff you see in the UI using Reverse engineer the Discourse API