Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Fetching atlassianId for users returns "unknown" although account exists

Norbert Spiess September 3, 2021

We're trying to automate some of our company wide processes regarding account management.

For that reason, I wanted to integrate the migration endpoint to fetch the atlassianId for specific users.

When I execute the request, I get a response with the ID on some users but not on others. While I get the ID correctly like for e.g. Max (email: max@company.com):

{ "username": "max", "accountId": "12345:0a913b9f-1d91-402a-8d52-665a9712345" }

For some other users (e.g. john@company.com), I get:

{ "username": "john", "accountId": "unknown" }

All of our users have a similar structure in regards to their email. As there is no dedicated "username" field on a user object, I assume the username is always the email prefix (e.g. max@company.com => user/bulk/migration?username=max).
However, for some users I can fetch the id, for others I can try what I want and just get this "unknown"... I see the users I'm asking for in the users/search response. See, that they have an atlassianId and the correct email configured...

What could be the reason here for this behavior? At least it's not random, but deterministic in the sense of "for user x, it always returns the id while for user y it never does.. 

1 answer

0 votes
Sunny Ape
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.
September 3, 2021

Hello @Norbert Spiess 

When you test that user's account to login, can you get into their account settings and confirm their username is the same as what you are searching for? Does the lookup of that user via their key also return no accountid?

Since a user's username can be changed independently of their email address, have you checked that a user with a known email address such as 'fred@company.com' that is not returning an accountid actually has the usernames 'fred' and that it's not been changed to something like 'freddy' or 'fred2' etc?

Also, have you tested getting that user's accountid by doing a plain search for them based on their email address, such as:

/rest/api/3/user/search?query=fred@company.com

and did it also return nothing for the accountid?

Lastly, if you've doubled checked using all these methods, then note that the Get accountids for Users endpoint is experimental, and may not yield predictable results, so that might just be root cause.

Norbert Spiess September 5, 2021

Hey David,

thanks for answering.

All of us log in via social means (google account to be precise), so we don't use the "regular" Atlassian username for logging in. Could you explain to me, what the key really represents? I assume it's the "tag", by which you can mention people.. I didn't see the point of looking into it, as using it as query parameter is deprecated..

I fetched all users via the search endpoint and see no "misconfiguration" or noticable difference regarding the values set on the accounts, that "work" and those, that don't. I'll try the email query though. I didn't see that that's possible. Update: Querying by email on the search endpoint does not have any effect.

Can I see the current username for an account somehow? All the user endpoints return are the email and displayName (and some technical values).. I read about "hacks", using the mentioning in Confluence or Jira..


To solve our issue, we might just store the accountIds on our end and use them later. As we create the accounts via the API, we (should) have them on this point in time anyway with the response.

Sunny Ape
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.
September 6, 2021

Hello @Norbert Spiess 

Sorry for suggesting searching by userKey; I'd forgotten that had been deprecated.

As to why searching for certain users by their email address, which I assume is the same as the email address used to login to their account, still does not provide that user's accountId, I have no solution, as I've never seen that happen.

I've used the Find user endpoint to search for the accountIds of 250+ users in a company based on their email address or their username (their displayName) and I've always had their accountIds correctly returned in the results.

My only other suggestion is that the user account (key + token) being used to perform that search doesn't have the permission to find those users, so the information is restricted. Try an admin's key + token instead.

Like Norbert Spiess likes this
Norbert Spiess September 6, 2021

I used one of our administrative accounts.. otherwise I think I wouldn't have been able to get anything (but I don't know)...

As I said, we'll solve it without having to ask for the atlassian id. Thanks for the help though!

Like tcunha likes this
tcunha
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!
April 15, 2025

So any known reason of why the unknows are being returned? I'm having the same issue.

This seem to be the only option that we can bulk identify account ids using API.

Suggest an answer

Log in or Sign up to answer