How can I get user email from Jira API?

yura.i
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 26, 2019

once Jira returned user emails but now i don't get it. Do you have any idea how to get user emails now?

5 answers

1 accepted

2 votes
Answer accepted
Mr J
Contributor
July 27, 2019

Hey there Yuriy, could you let us know which API call you used to obtain the email address? If you are on Jira Cloud, then it may be harder to obtain than before, as per the Cloud REST API for Get User Email : This API is only available to apps approved by Atlassian, according to these guidelines. 

The guidelines link brings you to this page : Guidelines for requesting access to email address. Long story short, you're going to need to apply with Atlassian to permit your app to use the API and retrieve user emails.

yura.i
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 27, 2019

Thank you for your helping!

2 votes
KORTX Support February 2, 2022

I had a similar issue with this.

 

I noticed that when I verified my domain and claimed those users as "managed accounts", the emailAddress values were included in the response for those accounts.

 

This is specifically in regards to 

GET /rest/api/3/user/search

GET /rest/api/3/users/search

 

I have not seem this documented or confirmed by Jira though.

1 vote
Pavel Junek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 26, 2019

Hi Yuriy,

What Jira version you use? I think, you must use REST API Auth, see https://developer.atlassian.com/cloud/jira/platform/jira-rest-api-basic-authentication/

Pavel

0 votes
Maksim Beliaev August 30, 2024

after some struggle I was finally able to find the solution with the experimental API

https://developer.atlassian.com/cloud/admin/organization/rest/api-group-users/#api-v1-orgs-orgid-users-search-post


you will need to create org API token (not your personal token)

here is the python script:


import requests

# Atlassian credentials, get from https://support.atlassian.com/organization-administration/docs/manage-an-organization-with-the-admin-apis/

api_token =
organization_id =


url = f"https://api.atlassian.com/admin/v1/orgs/{organization_id}/users/search"

# Define headers with Bearer token
headers = {"Authorization": f"Bearer {api_token}", "Accept": "application/json"}

response = requests.post(
url,
headers=headers,
json={
"emailDomains": {"contains": "canonical.com"},
"expand": ["EMAIL", "EMAIL_VERIFIED"],
},
)
response.raise_for_status()

content = response.json()

 

0 votes
Maksym Ivanchenko March 24, 2021

Hi All,

If you are an org admin (for Jira cloud) you can use this API call, bypassing limitation from Atlassian:

https://developer.atlassian.com/cloud/admin/organization/rest/api-group-orgs/#api-orgs-orgid-users-get

It will return you all user info within your organization. However, it only returns 50 users at a time so you'll need to iterate until the list is ended.

I use it with combination of other JIRA API calls to get all user emails within a project.

 

Maksym

Martin Hilbig _team neusta_
Contributor
November 5, 2021

getting all user emails in a project is exactly what I need but I have no idea how to get there :D

Suggest an answer

Log in or Sign up to answer