Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Rest API endpoint to get inactive user ID

Joao Zampa February 23, 2021

Hi everyone.

I need to be able to get the Active and INACTIVE user account ID using the user account email.

At the moment I am able to get ACTIVE users id by hitting the endpoint:
https://<my domain>.atlassian.net/rest/api/latest/user/search?query=user.email@mydomain.com.

Unfortunately, this endpoint does not return the ID if the user is INACTIVE.

Does anyone know how I can get the user account ID for inactive users?


1 answer

1 accepted

1 vote
Answer accepted
Prince Nyeche
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.
February 24, 2021

Hi @Joao Zampa 

Welcome to community! While using the search user endpoint, rather than calling one user at a time by defining an email, don't use the query parameter. Instead use the startAt parameter (which searches record by record) and run a loop to call all user and filter the data by "active" status. 

 "active": false

Then you can grab the users that are returned. However I would say you should filter by "accountType" as you don't want to include app users as well.

Joao Zampa March 1, 2021

Thanks @Prince Nyeche , 

I will try to figure out how to use it, one quick question, we have around 40k accounts, do you foresee an issue?

Prince Nyeche
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.
March 1, 2021

There shouldn't be an issue. I'm assuming the 40k accounts are referring to customer only accounts? Then I would suggest you use the filtering of

"accountType": "customer"

This way you can get only customer only account rather than agent or Jira user account.

Joao Zampa March 10, 2021

Hi @Prince Nyeche ,

So let me explain a bit better what I am trying to do. 
I want to be able to remove the user from all the groups programmatically and for that, I need the user ID.
If the user is active I can find his/her id using the API I mentioned but if I want to find a specific user id, I would have to do one call for each 1k user till I find the user ID I am searching for.
If I have to do this for many users, the API calls start to add up.

Is there a way to find the user ID for a specific inactive user (Atlassian account not Portal only account) by providing the user's email address?

Prince Nyeche
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.
March 10, 2021

Hey @Joao Zampa 

Since searching via email address wouldn't work for inactive users, I suggest you extract all the list of atlassian users (active or inactive) and save it to a file or configuration then refer to that file or configuration and get the user you need rather than calling the api all the time. However you might need to think of a way to find the user most probably by display name. Also you can create a function that updates the record of the stored file from time to time to ensure that the data stored is accurate.

Joao Zampa March 10, 2021

That is kind of a workaround we were thinking of, just wanted to make sure that there is no endpoint that we can use to do one call.

Thanks!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events