How to get group memberships of a group via the gitlab api?

For a extension of gitlab, I tried hard to find the gitlab api request to get the group memberships of a group.

I have a (main) group called “sharing”. I have added in the members-section an additional group “teacher”


Is there any way to retrieve the information of the group members from the “sharing” group via the gitlab api? I.e. information about the “teacher” group from the “sharing” group (not the 2 users contained explicitely in sharing).

If I use https://[gitlab-URI]/api/v4/groups/:group-id-of-sharing/members I only get the 2 user members, but not the group members!

I have read Group and project members API | GitLab very carefully. However there is no hint on retrieving group memberships if groups :frowning:

Thank you for your support



There is this part in the docs about inherited members: Group and project members API | GitLab

curl --header "PRIVATE-TOKEN: your-token-here"

does that do it? The important part is on the end of the url “/all/” if you do it without “/all” then it will just do members of the group and not the inherited ones.

Hello iwalker,

No, …/members/all also does only return users not groups.

However finally I found the answer myself:

Indeed the group memberships are available directly via the project api https://[gitlab-URI]/api/v4/groups/35/

   "shared_with_groups" : [
         "group_full_path" : "teacher",
         "group_name" : "teacher",
         "group_id" : 771,
         "group_access_level" : 30,
         "expires_at" : null

This was not the place I had looked for :frowning:

Best regards


1 Like