Account Id using the Rest api

Chan Pad May 10, 2020

I have seen a couple of posts, but am not getting a good answer to how I can find the accountId of the user. I know the user email address, so what I have been doing is following this link below:

https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-user-bulk-migration-get

I type in the email address as both the username and key and I get this back:

I even tried with the display name

[    {        "username""xxx@hotmail.com",        "accountId""unknown"    }]

Why am I getting an unknown? 

Thanks

2 answers

6 votes
Angélica Luz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 13, 2020

Hello Chan,

Thank you for reaching out to Atlassian Community!

Testing using the details you provided, to be honest, I couldn't make the "Get account IDs" work, but the good thing is that there are two other options to get the account id.

The first option is to use the "Group and user picker" API that will return the information about the user using their email address.

curl --request GET \
--url 'https://domain.atlassian.net/rest/api/3/groupuserpicker?query=user@domain.com' \
--user 'admin@domain.com:A1b2345CdEfgHIJkLMn67O8Q' \
--header 'Accept: application/json'

The second option is to use REST API call below directly in the browser:

https://domain.atlassian.net/rest/api/latest/user/search?query=user@domain.com

Please, give it a try and let us know how it goes.

Regards,
Angélica

Sai Avinash Duddupudi September 27, 2020

Wow... Thanks a lot Angélica. This is amazing.....worked like a charm!

Like Angélica Luz likes this
Kanchan Katkar June 1, 2021

Thanks a lot, it works for me!!

Like # people like this
Tunahan Tez
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!
March 2, 2022

Great! Thanks Angélica. The documentation does not elaborate what the end point expects as query params. Was trying JQL for the whole time without result. Thanks again :)

Like Angélica Luz likes this
Andrew Marshall March 23, 2022

Does a similar solution exist for Confluence? I am attempting to use the /wiki/rest/api/user/bulk/migration endpoint to return accountIds from usernames, but I only get the same usernames returned to me that I passed in, with no accountIds.

Kritik Jain
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!
October 19, 2022

Thanks Angélica!!!. You saved a lot of time. I was also stuck with the JQL which wasted a lot of time. This worked like a charm.

 

Thanks again!

Like Angélica Luz likes this
natalia_lezhai April 19, 2023

Hi Angelica! what should I do if I have like 100 users i need accountid of? ii cant just go one by one right?

Hisato TANAKA
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!
June 19, 2023

We are in the process of trying to migrate to Cloud,
I have been struggling with this problem for a long time because there is no simple way to get the accountId from the email. Just the other day I discovered this page and solved this problem.
Thanks Angélica-san.

@Andrew Marshall 
It's been more than a year, so you may have already solved the problem.
Confluence doesn't have this kind of API either, but if we set up JIRA in the same organization as Confluence, we can use the JIRA API above to look up users in Confluence, or rather in your organization. I also use JIRA API for Confluence.

It is also possible with JIRA in the Free plan, so try to set up JIRA now, if you are still suffering from this problem.

1 vote
Amir Katz (Outseer)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 8, 2022

Suggest an answer

Log in or Sign up to answer