Can I create subgroups in a group with one request?

Hello everyone,

I am quite new to Keycloak and spring boot 3.0.1 and I have been assigned to figure out how to create a group and it subgroups in a single request with.

So far the only way to create a group and taking its id. Then create a subgroup using the parent id as referenced in the Keycloak admin REST Api.

Is is possible to do them all in a single request?

I tried using setSubGroups from the GroupRepresentation class and it didn’t work out. Any other Ideas ?


No, the API requires you to create them independently, and then assign child groups to them.

It would be theoretically possible to build a custom REST extension to Keycloak that did this in a single transaction, but it’s not in there now.

1 Like