# Manage Users Programmatically

**URL:** <https://meta.discourse.org/t/manage-users-programmatically/183958>\
**Category:** Development\
**Created:** [March 21, 2021, 6:13pm UTC](https://meta.discourse.org/t/manage-users-programmatically/183958 "2021-03-21T18:13:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samir\_Faci](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/samir_faci/32/119582_2.png) [@Samir\_Faci](https://meta.discourse.org/u/Samir_Faci)\
**Post date:** [March 21, 2021, 6:13pm UTC](https://meta.discourse.org/t/manage-users-programmatically/183958/1 "2021-03-21T18:13:02Z")

</div>

I’m looking for a way to programmatically create/delete and especially revoke admin permissions to particular users.

I’d love an ansible module but even lacking that is there a way to use the discourse API to say given user Bob to grant/revoke moderation and admin privileges?

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [March 22, 2021, 1:00am UTC](https://meta.discourse.org/t/manage-users-programmatically/183958/2 "2021-03-22T01:00:47Z")

</div>

I could make an ansible module to do that. It might be easier to run a rails command in the container rather than use the API, though I haven’t looked to see for sure. I’ve used both methods for other automatons. If you’ve a budget message me or find my contact info in my profile.
