REST API: How can I find user via primary or secondary email

I have users with 2-3 email addresses in Okta, and they I want to be able to call an API with any of these addresses and get back the user. Basically, I want the program I’m building to use the canonical address, without knowing it in advance.

Does the /Users query or filter function also return results for non-primary email fields?

I’ve looked at the docs, but it’s not clear to me if secondary emails are in scope.

If not, is there a recommended way to use REST API calls to get the information I want?

TIA

You can call /users endpoint to do a search/filter based on required attributes (I believe filter supports only a limited set of attributes). Here is the URL, if you were not able to find it Users | Okta Developer

1 Like

Hi, thanks for the reference.

I’m already ok with making calls to user search or q for the primary email or a profile.secondEmail.

I’m looking for a single call that will give me a result for an email that is either in profile.secondEmail field or profile.email (or possibly profile.login)?

Basically, "if any email on the user record matches “mcroft@whiterose.org”, return the user object.

Do I need 3 calls or can I do this more simply?

you should be able to build an expression with or to check the value against any of the 3 attributes

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.