Username from user mail
Asked by Dishant Sharma:

I am using confluence server 7.13.7. Is there a way through which I can get a user's username through the user's mail?


Answers:
author: Fabio Racobaldo _Herzum_
body: Hi [@Dishant Sharma](/t5/user/viewprofilepage/user-id/5038742) ,

In the Users\&Security-\>User you can search a user based on username or email. So, as a Confluence Admin, if you go to Administration -\> User Management -\> Users you can perform that action by yourself.

Hope this helps,

Fabio

comments: author: Dishant Sharma
body: [@Fabio Racobaldo _Herzum_](/t5/user/viewprofilepage/user-id/781528) Thanks for the reply. Actually, I was looking for a REST API so that I can use the returned username inside my code.


author: Fabio Racobaldo _Herzum_
body: Hi [@Dishant Sharma](/t5/user/viewprofilepage/user-id/5038742) ,

you can try this Rest API <https://docs.atlassian.com/software/jira/docs/api/REST/9.3.0/#api/2/user-findUsers>

![Immagine.png](https://community.atlassian.com/t5/image/serverpage/image-id/219039i8E5EC54E71AF65BB/image-size/large?v=v2&px=999 "Immagine.png")

Hope this helps,

Fabio


author: Alex Koxaras _Relational_
body: [@Fabio Racobaldo _Herzum_](/t5/user/viewprofilepage/user-id/781528) the API you provided is for Jira, but [@Dishant Sharma](/t5/user/viewprofilepage/user-id/5038742) is asking for Confluence. Unless the latter really wants for Jira and he mistakenly stated Confluence. Can the above work for Confluence?


author: Fabio Racobaldo _Herzum_
body: You are right [@Alex Koxaras _Relational_](/t5/user/viewprofilepage/user-id/4150197) . It seems to be not existing for Confluence.

I found the following ticket <https://jira.atlassian.com/browse/CONFSERVER-47399> that seems to be be fixed without a suggestion.


author: Alex Koxaras _Relational_
body: Nice [@Fabio Racobaldo _Herzum_](/t5/user/viewprofilepage/user-id/781528) and thank you for sharing this! It would be great if they would the endpoint as well.. :/


author: Alex Koxaras _Relational_
body: Hi [@Dishant Sharma](/t5/user/viewprofilepage/user-id/5038742)

You could get it by using scriptrunner. What do you want to achieve?

comments: author: Dishant Sharma
body: [@Alex Koxaras _Relational_](/t5/user/viewprofilepage/user-id/4150197) thank you so much for the reply. Actually, I want to get a user's name on the basis of their email. I will have the list of user emails in a confluence instance and I want to fetch their username so that I can use it for making other API calls to get some more details about that particular user. I will also have the required administrative privileges to make such API calls.


author: Alex Koxaras _Relational_
body: [@Dishant Sharma](/t5/user/viewprofilepage/user-id/5038742) I don't get it..

A user will send you an email.

You want from that email to get the users' username automatically (?).

And make some API requests.

Correct?


author: Dishant Sharma
body: [@Alex Koxaras _Relational_](/t5/user/viewprofilepage/user-id/4150197) Yes, I want the user's username.


author: Alex Koxaras _Relational_
body: Sorry but the above logic it doesn't make sense to me...

If you want to get the user's username from an email you got in your email inbox, then Confluence is not the place to look for. I think that you have not setup the proper stage for us. I mean that I can understand your request (get the user's username) but you haven't told us from where you want to get this.


author: Dishant Sharma
body: [@Alex Koxaras _Relational_](/t5/user/viewprofilepage/user-id/4150197) sorry, actually I mean I want an API in which I can pass the user's mail as a query parameter and I can get back the user's username associated with that email address.


author: Alex Koxaras _Relational_
body: [@Dishant Sharma](/t5/user/viewprofilepage/user-id/5038742)

Thank you for the clarification! Try the following then:

```
/rest/prototype/1/user/non-system/USERNAME
```


Tags: confluence-administration

confluence-app

confluence-development

confluence-server

new-to-confluence

questions-for-confluence

server