Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×I'm an administrator of a Bitbucket account. Under my account I've more than 50 repositories and 5 more groups.
I'm using Bitbucket API to get list of open pull requests. I want to notify the reviewers to take necessary action on the OPEN pull request. For sending notification I need the reviewers email addresses, but I cannot find any API for getting email address from username.
Is it possible to get email addresses of user by using their username?
This is a very basic repository administration feature that most teams want
This is so stupid, I added all users by emails - so I know emails, they have created accounts and now I can't see those emails, I have to ask each one what email did they use and some don't even remember, and of course it's hard to find it in chat with every user because I added them several months ago
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
+1
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
+1
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is an workaround for those who also using jira
Here is a powershell snippet:
# bitbucket users
$org = "contoso"
$username = "username@contoso.com"
$password = "********************"
$headers = @{ Authorization = "Basic " + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$($username):$($password)")) }
$bitbucket = Invoke-RestMethod -Headers $headers -Uri "https://api.bitbucket.org/2.0/workspaces/$org/members?pagelen=100" | Select-Object -ExpandProperty values | Select-Object -ExpandProperty user | Select-Object display_name, nickname, account_id
# jira users
$org = "contoso"
$username = "username@contoso.com"
$password = "********************"
$headers = @{ Authorization = "Basic " + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$($username):$($password)"))
$jira = Invoke-RestMethod -Headers $headers -Uri "https://$org.atlassian.net/rest/api/3/users/search?maxResults=500"
$jira = $jira | Group-Object accountId -AsHashTable
# join
$bitbucket | Select-Object display_name, @{n='email';e={ $jira[$_.account_id][0].emailAddress }}
Which will print your bitbucket users and their emails
How it works:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is it possible to get email addresses of user by using their username?
No. Email addresses are considered somewhat personal and are not disclosed to other users.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you saying even repository(private) admins also don't have permission to get emails of their users?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That is correct.
Now this approach is far from perfect, as you can look at the commit browser that resolves commits to Bitbucket accounts and then look at the email address in the raw commit object. However, we do not openly disclose user-to-email data).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What if user need to reset the passwd and he's not sure what is the exact email address. or else resetting passwd of a common checkout user . ho we can see where we get the mail. even site admin cant check the email address?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Finally we moved to Gitlab. And it is offering full admin rights over all users
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Wondering how to achieve following: we have 40 people in our team and need to check whether all of them are using corporate email or not?
Or this one - we have email addresses for each team and wish to know how do they perform, but without knowing their bitbucket usernames it is not possible
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is impossible with cloud, we have turned on SAML 2.0 in Jira to ensure that future users are signing up with Corporate mail but there is no way for us to tell with existing. We are also trying out bitbucket server to see if this could be a better option.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes I understand that just wish to show few more use cases when this might be required. I do respect user privacy, but we are talking here for closed teams where we already do know everything about people in teams so hiding their emails seems like a pretty strange step. May be it is possible to show emails for private team members or something like this
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Totally agree @Alexandr Marchenko , when its private if you have access to the repo emails should be exposed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Every time I think I've found the stupidest problem/omission with Atlassian products, I find another. As the admin on our account, I have personally invited users to our account to access our code for work. We have quite a few users, and at some point we were acquired by another company, so there are two email domains to our user's email addresses. As admin, I should have access to this info to migrate users to the newest iteration of email domain.
There should be no expectation of privacy protection over a user's email address who is accessing my PRIVATE account's repositories at my request. This is just flat out stupid.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Our team have about 340 private repositories, and all users have corporate e-mails, so they are not private, but as team administrator I can't get then via API? why? I can to understand rezone to not show on public repository e-mails of users to not team members, but inside same team or workspace why administrator can't get e-mail of his team member? what is purpose for this policy?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This omission shows a blatant misunderstanding about how corporate technology works. In order to use these endpoints, we need a reliable method to match BitBucket identities with corporate identities. I know you want us to move to your cloud products. This is one of the many reasons we are moving in the opposite direction. GitHub is just as bad in this regard.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.