Retrieve User Emails VIA API

Currently our team is integrating with Gitlab as a provider on our platform. At the moment we are using the golang client GitHub - xanzy/go-gitlab: GitLab Go SDK to retrieve user information; however, we are unable to retrieve the users email. By the looks of it on their documentation Users API | GitLab you have to be an admin to see Email.

Is there anyway around this? We would like to retrieve the user email. Also, I created the gitlab account, how am I not the admin? Still searching for answers online. Thanks in advance :slight_smile:

Hey @stephen1, is this regarding GitLab.com? If so, then it won’t be possible for you to retrieve the primary email address associated with other GitLab.com accounts unless a user you’re querying for has chosen to publicly display their email address. This is primarily because each account on GitLab.com is owned by the specific user that created it.

End-users of GitLab.com are also not granted administrative privileges for the reasons outlined in our documentation.

1 Like

Hey @Tristan, and is it possible to get the email address for an Premium or Ultimate Plan? I’m facing the same issue and I need to get the email to audit employee’s access to gitlab for security reasons. How can I do it?

@rafasalo the answer is the same. It doesnt matter what plan you have. The user must make it publicly visible if you are using gitlab.com. If you have your own server then use a login with admin rights and then you will see it.

Since only the Gitlab team can be admins of gitlab.com then the only way to resolve is run your own server and be an admin or have the users publicly display the email when using gitlab.com. But if you don’t wish other users of gitlab.com to see this then your only solution here is to run your own server.

1 Like

Thanks for the input @iwalker, you’re spot on. To add onto that, @rafasalo, it will be possible for GitLab.com users to retrieve the primary email address of users within their groups once we implement Enterprise Users if you want to follow along with that Epic.

1 Like

@iwalker How to make it publicly visible if you are using gitlab.com, I can’t setting public email for users

@yooledev the user must decide themselves if they want their email publicly available or not. They do it in user preferences.

This definitely needs to change for some Enterprises to be able to use your .com offering, I’d assume…are there plans to fix it? Any open issues to follow?

Yes, this definitely needs to be changed for enterprises who use gitlab.com. enterprises need to have full control on user management in the same way as it’s done for self-managed.

here this is our use-case. we are onboarding our users on gitlab.com manually and once the user completes their account setup, we don’t have a to control their account except removing them as a member from our group.

recently 2 of our users registered on gitlab.com but they think there was a typo in their email address and hence they never got the email confirmation to their actual email address. so, now we can’t see what email they have entered during the registration process using the API and we don’t have a way to update it. the only way to get this resolved is to open a support ticket.

Enterprises need the ability to administer their user accounts on gitlab.com in the same manner as it’s done for the self-managed instance.

Is it still same sitituation now also or is it resolved. Can i see the email address of my group members if they have made it private visibility to their email with admin access token. asking because its 2024 now, and your reply was 3 years back.