We have introduced a new suite of Admin API endpoints to better streamline the management of roles in your tenant. You can list all (default and custom) roles, and create, update, or delete custom roles programatically.
We have also added an include=team_memberships query parameter to the Admin Users API. This includes each user's team memberships, along with their role.
Learn more at our Admin API docs page.