# API request for anonymizing users

**URL:** https://meta.discourse.org/t/api-request-for-anonymizing-users/134171
**Category:** Development
**Created:** [November 22, 2019, 2:22pm UTC](https://meta.discourse.org/t/api-request-for-anonymizing-users/134171 "2019-11-22T14:22:32Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![op\_ukrop](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/op_ukrop/32/161972_2.png) [@op\_ukrop](https://meta.discourse.org/u/op_ukrop)
#### Post date: [November 22, 2019, 2:22pm UTC](https://meta.discourse.org/t/api-request-for-anonymizing-users/134171/1 "2019-11-22T14:22:32Z")

</div>

Hello.  
Do we have an opportunity for anonymizing many users at the same time?  
API or maybe database requests?  
Thanks.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [November 22, 2019, 2:54pm UTC](https://meta.discourse.org/t/api-request-for-anonymizing-users/134171/2 "2019-11-22T14:54:23Z")

</div>

> [@op\_ukrop](#):
>
> Do we have an opportunity for anonymizing many users at the same time?

There is no API route to bulk anonymize users. You will need to anonymize one user at a time.

---

<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: [November 22, 2019, 3:05pm UTC](https://meta.discourse.org/t/api-request-for-anonymizing-users/134171/3 "2019-11-22T15:05:56Z")

</div>

One could do it at the rails console. You’d need to read the code to find out what the call is, then loop through the users you want to make anonymous.

Well, I got curious and there was a link to the code the other topic you were discussing this in.

Something like:

```plaintext
users=User.where(some way to get users--maybe add them all to a group)
users.each do |user|
  a=UserAnonymizer.new(user)
  a.make_anonymous
end

```
