Searching user by email doesn't work (API)

Hello,

I’m trying to get a user with his email address though the API but it doest not seem to work like intended.
The documentation says we can use an id, a username or an email address.
I have already tried the following requests:
curl --header “PRIVATE-TOKEN: MY-TOKEN” “https://URL/api/v4/users?username=user@gmail.com
curl --header “PRIVATE-TOKEN: MY-TOKEN” “https://URL/api/v4/users?search=user@gmail.com

I have also tried with the users.list() method from the python-gitlab lib but it does not work either.

It works fine with a username or a user id.

Is that a known issue ? Is this feature not available anymore and the documentation is outdated ?

Regards
Nicolas

What permissions does the user who is searching have? Is the email address publicly available or private?

If the users email is private, then unless the user who is searching has admin privileges you cannot search via email. It would have to be publicly available.

Also to search via email address, you are using the wrong field:

https://gitlab.example.com/api/v4/users?email=user@gmail.com

this works if the email is private, and the API user has admin privileges, or if the email is publicly available, and the user has standard privileges.

Also explained here in previous posts: Retrieve User Emails VIA API - #4 by iwalker