GitLab API. Get Current user information

Is it possible to get information only about current user with existing GitLab APIs?
For example i have personal access token and want to get my profile information: name, login, etc.
Unfortunately users APIs return list of users.
May be i skipped some filter for this?

You should use the /user/ API: https://gitlab.com/api/v4/user/

I’ve already tried to use it. It returned list of available users. Problem is that i cannot determine who is current user at this case. Does this resorce have any special parameters to show only current user?
I’ve read next documentation https://docs.gitlab.com/ee/api/users.html and cannot find such parameters.
I don’t have user name or userid. Only access token.

Thank you. My mistake.
i’ve read about “users” resource. Needed “user” resource is in the middle of text after admin description.
it https://gitlab.com/api/v4/user/ helps to me.

Thank you very much for helping.

hi , i m trying with the same https://gitlab.com/api/v4/users/ to get all the users info , but it displays only few users says 23 users but we have 500+ users.

@Prakash As I mentioned in your other post, use pagination, see below link:

?per_page=100

you cannot exceed 100 it’s the limit, so as I said in my other post, read the API docs and script it to set per_page and then when you know that you have 5 pages (500 users):

?per_page=100&page=2

incrementing the page number.

@iwalker Thank you its working

1 Like