
ekz2o (ekz2o) asked a question.
Hi Team,
I want to know all the groups that the user is part of using APIs. I tried api/v1/users API and see no group information.
Alternatively, I have used api/v1/groups and not no user info.
Can this be possible using APIs? if so, can you please point the apis to list the groups for an user and also API to update the same.
Thanks,
Anil.

Hi Anil Vippala ,
You can use " /api/v1/users/${userId}/groups " for listing groups in the user is a member . Here in the /${userId}/ section you have to add the userID of that particular user .
Thanks @b5n6c (b5n6c),
This works.
Do we have any API to update the groups for a user? Please let me know.
Yes, you can add a user to a group via API as seen below:
Add User to Group:
PUT
/api/v1/groups/${groupId}/users/${userId}
this adds a user to an Okta group via API. For {groupId} and {userId}, you will need to specify the IDs for both that are unique to your use case.
I would recommend the Postman collections for Okta, where you can download and view all the API calls discussed here and many more. As with anything, I recommend and training and testing in a Preview environment first before moving to production.
postman Okta collections
also, the links to the Okta Groups API:
Groups API
Thanks @DonF.81354 (Customer) , This will help.