API to get Account ID from Email Address?

We are using Power Automate to create some flows to create Jira issues. All is working successfully, but we’d like to insert the Reporter as the person submitting the form. We have to pass the ‘accountId’ of the user, so is there an API I can call by passing in the user’s email address and returning the ‘accountId’ that I can pass in?

Thanks in advance,
Chris

Hi @ChrisGreen ,

Given an email address, you can try Find users API if it fits your use case.

EDIT:
You can pass the email address in the query query parameter just like /rest/api/3/user/search?query=ian@myemail.com. The accountId will be part of the response.

Cheers,
Ian

2 Likes

Hello @ChrisGreen

The Find users endpoint.

— Rats. Pipped by seconds :slight_smile:

1 Like

@iragudo - Boom! Thanks so much!

Chris

1 Like

@ChrisGreen I am trying to do the same with Power Automate. How did you setup the connector? Did you use send HTTP request?

I’m using a GET to https://proctorujira.atlassian.net/rest/api/3/user/search?query= and then I parse the results which contains the ‘accountId’.

What type of authentication are you usuing? I am trying basic with email and apikey but it doesnt authenticate and i get the error that it is deprecated?

@ChrisGreen I ended up generating a new api key was able to get it to work. Thanks so much for your response!

Trying exactly this today, and all I’m getting is an empty array, even when I use my own email. Anyone have any idea if something has changed with these?

Thank you!

I get this to work for all users within my domain, but I do have outside contributors and then I send a gmail address there I just get an empty result even though that email address has an account.
Any idea ?
I need to be able to set external sources as reporters, any thoughts or ideas ?

If you’re trying to look up a user by accountId, /rest/api/2/user?accountId=<accountId> worked for me.

The accountId query param isn’t documented afaik (Jira 9.4.0). It’s nice the api responded saying it exists (that’s how I found it).


My usecase was for finding the user’s displayName in a mention inside a comment (e.g.

This is a comment @User

returns

This is a comment [~accountid:<accountId>]

in the api)