Auth0 Home Blog Docs

Can I make group api calls with group names instead of id (guid)


#1

My flow involves creating groups with fixed names and assigning users to a subset of them when they sign in for the first time. At this time, I know the name of the group but not the guid. When I call an api, eg add user to groups, it throws an error saying:
{ statusCode: 400,error: ‘Bad Request’,message: ‘“0” must be a valid GUID’,validation: { source: ‘payload’, errors: [Array] } } }

All the group apis seem to require the id (guids) and I cannot find an easy way to map from group name to group id either. What is the recommended way to use these apis if I have the group name?


#2

Found the solution to this. The get groups call does allow for a query param “?q=” and a “field” param that I set to “name” to get the group ids.