# Managing multiple user groups via REST API

**URL:** <https://forum.keycloak.org/t/managing-multiple-user-groups-via-rest-api/15927>\
**Category:** Getting advice\
**Created:** [June 9, 2022, 5:31pm UTC](https://forum.keycloak.org/t/managing-multiple-user-groups-via-rest-api/15927 "2022-06-09T17:31:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![leop](https://avatars.discourse-cdn.com/v4/letter/l/e95f7d/32.png) [@leop](https://forum.keycloak.org/u/leop)\
**Post date:** [June 9, 2022, 5:31pm UTC](https://forum.keycloak.org/t/managing-multiple-user-groups-via-rest-api/15927/1 "2022-06-09T17:31:04Z")

</div>

Hello there. I’m trying to figure out if is there any way to change multiple groups of a specific user via REST API.

When I create a user via POST to endpoint {{keycloak\_url}}/admin/realms/{{realm}}/users, I can pass an array containing the groups that I want for that user and it works perfectly!

But when I try to update the same user via PUT to endpoint {{keycloak\_url}}/admin/relalms/{{realm}}/users/{{userID}}, It updates the user info (email, attributes, etc) but ignores the new array of groups that I passed the same way as I did before.

I already checked the names of groups and it matches with existing groups in my realm, so of course that’s not the problem.

In Keycloak documentation, it says that the PUT {{keycloak\_url}}/admin/realms/{{realm}}/users/{{userID}} endpoint can receive an UserRepresentation, wich includes the groups array.

I’m using Keycloak 18.0. Appreciate any help.
