How to get User ID of perticular user though API

How to get User ID of perticular user though API, when I don’t know the ID of particular user.

I tried below code and it is working:

curl -v -X GET
-H “Accept: application/json”
-H “Content-Type: application/json”
-H “Authorization: SSWS ${api_token}”
https://org.okta.com/api/v1/users/00ub0oNGTSWTBKOLGLNR

But what if I don’t know the user_id (i.e “00ub0oNGTSWTBKOLGLNR”) while hitting the End point

Hi @pooja1

You can do a request to /api/v1/users with either filter or search in order to list all the users that match a particular query (for example username/login, email, first name, last name).

Here’s a cURL example to search based on username

curl -X GET \
  'https://org.okta.com/api/v1/users?filter=profile.login%20eq%20%22user@domain.com%22' \
  -H 'Accept: application/json' \
  -H 'Authorization: SSWS <API_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
1 Like