# Deleting a user via discourse api

**URL:** https://meta.discourse.org/t/deleting-a-user-via-discourse-api/348202
**Category:** Support
**Created:** [January 20, 2025, 1:42pm UTC](https://meta.discourse.org/t/deleting-a-user-via-discourse-api/348202 "2025-01-20T13:42:53Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![selase](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/selase/32/270909_2.png) [@selase](https://meta.discourse.org/u/selase)
#### Post date: [January 21, 2025, 3:22pm UTC](https://meta.discourse.org/t/deleting-a-user-via-discourse-api/348202/3 "2025-01-21T15:22:36Z")

</div>

I’m not sure about the specifics of the user you’re trying to delete, but the error you’re seeing likely stems from one or more of the following checks not being met.

> [@Deleting a user account](https://meta.discourse.org/t/deleting-a-user-account/312021/1):
>
> ### Important settings:
> 
> - **`delete_user_max_posts`** : Determines the maximum number of posts a user can have for their account to be eligible for deletion. For example, if set to 5, users with more than 5 posts cannot be deleted.
> - **`delete_user_max_post_age`** : The number of days since a user’s first post, within which the user can be deleted. For instance, setting this to 30 means users with posts older than 30 days cannot be deleted.
> - **`delete_all_posts_max`** : The maximum number of posts that can be deleted at once using the “Delete All Posts” button. For example, setting this to 100 limits bulk deletions to 100 posts at a time.

> <https://github.com/discourse/discourse/blob/f0d6e9758dda7efd214d054f6755d31a14db3338/lib/guardian/user_guardian.rb#L60-L74>

Most likely, it’s something in the `else` block. And yes, I agree, the error message could definitely be less vague 😬.

---

_[View the full topic](https://meta.discourse.org/t/deleting-a-user-via-discourse-api/348202)._
