Activate a user via Okta API Skip to main content
How satisfied are you with the Okta Help Center?
Thank you for your feedback!
How satisfied are you with the Okta Help Center?
Very Dissatisfied
Very satisfied
Enter content less than 200 characters.
Ask Search:
Patrick CesardPatrick Cesard 

Activate a user via Okta API


In order to activate a disabled user in Okta, the Activate User API call requires the userkey (a key that is 20 alpha-numeric characters long) of the user in Okta. However in order to obtain that key, I normally use the Find User API call where I supply the user's name or email address, and the response back which contains the userkey.  The problem is that when the user is deactivated in Okta, the Find User API call returns empty, so cannot get the userkey.
Thoughts on how to activate a user in Okta via the API if you dont have or cannot get the userkey?

Find User API call:

Activate User API call: 
Raphael LondnerRaphael Londner (Okta, Inc.)
Hello Isaac,

You're correct that the ?q= query will only return activated users.

However, you can still retrieve your deactivated users in multiple ways:

1. By "Deactivated" status: {{url}}/api/v1/users?filter=status eq "DEPROVISIONED"
2. By login/username: {{url}}/api/v1/users?filter=profile.login eq "[username]"
3. By email address: {{url}}/api/v1/users? eq "[email]"

I hope this helps, but please let us know if you need any further help.
Patrick CesardPatrick Cesard
Excellent, thank you Raphael!
Btw, is this documented online and I missed it? I saw the API doc for list user with status but didn't see those opther filter options you listed:
Andrew SohnAndrew Sohn (Okta, Inc.)
Each endpoint (i.e. /users, /apps...) supports different filtering parameters specific to that endpoint.  
In the documentation you can look under the specific endpoint (i.e "List Users") and there should be a "Filtering" section that documents the supported options. Here is the link for /users...
api-workday api-workdayapi-workday api-workday

Outside of the filter and query capabilities I think it is important to note that the standard Get User interface:
GET /users/:id

will "Fetch a specific user by id, login, or login shortname (as long as it is unambiguous)."

For sequences like you describe (activating a user) i don't generally know the Okta UserID but i always know their Okta Login. I'll fetch the user object using:
GET /users/

And then proceed as you describe above to activate the returned user.