Hey everyone! I've been learning how to use the Okta API for basic user management tasks. I needed a way to disable a bunch of users at once, so I wrote a Python script for it.
I thought it might help other beginners. It's pretty simple and uses the official SDK. You just need a list of user emails or IDs. I put it on GitHub. Let me know if you have tips to make it better! 😊
It's great to see community members sharing practical tools like this. For anyone using this script, I'd suggest thinking about adding a dry-run flag first, so you can output which users would be affected before actually making the state change. That's saved me from a couple of embarrassing mistakes in the past.
Stay grounded, stay skeptical.
Absolutely agree with the dry-run suggestion, that's a fantastic safety net. I'd add that for scripts like this, logging is another layer you really want. Even with a dry-run, having a timestamped log file of which users were actually disabled, along with the API response for each, can be a lifesaver during audits or if you need to reverse a specific action later.
Maybe also consider a rate-limit check or a small pause between calls, depending on your user list size. Some APIs can get unhappy if you fire off a hundred requests in a second.
customer first