How to find a user with the user ID
Description
This article describes how to search for a user when only the numerical user ID for an account is available.
Environment
Impacted offerings:
- GitLab.com
- GitLab Dedicated
- GitLab Self-Managed
Prerequisites
- API access to the GitLab instance
- GitLab.com users must authenticate into GitLab
Solution
For Gitlab.com and GitLab version 17.11 and above, a redirect has been made for the address https://gitlab.example.com/-/u/<user-id>
.
If signed in, this will redirect to the user's information page.
Workaround
-
For all versions of GitLab earlier than 17.11, user information can be found by querying the users API endpoint.
For example, to find the username in GitLab.com associated with the user ID
1
, visit the endpoint https://gitlab.com/api/v4/users/1 -
You can then search for users in groups and projects using the returned username.