# Deleting a user via discourse api

**URL:** <https://meta.discourse.org/t/deleting-a-user-via-discourse-api/348202>\
**Category:** Product 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:** 4

<div class="post-metadata">

**Author:** ![gormus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gormus/32/428592_2.png) [@gormus](https://meta.discourse.org/u/gormus)\
**Post date:** [January 21, 2025, 5:19pm UTC](https://meta.discourse.org/t/deleting-a-user-via-discourse-api/348202/4 "2025-01-21T17:19:09Z")

</div>

> [@selase](#):
>
> Most likely, it’s something in the `else` block

Spot on @selase! Seems like my user has more posts than `User::MAX_STAFF_DELETE_POST_COUNT` and also some are older than `SiteSetting.delete_user_max_post_age` 🙂

- **`delete_user_max_posts`** : must have been renamed to **`delete_user_self_max_post_count`** since the article posted. It is set to `1` (default)

- **`delete_user_max_post_age`** is set to `60` (default), and the user has posts over `60` days.

- **`delete_all_posts_max`** is set to `15` (default), and my user has `12` posts

Once I eliminated the restrictions, I was able to delete the my user via the API call.

```json
{"deleted":true}

```

> [@selase](#):
>
> And yes, I agree, the error message could definitely be less vague 😬.

😁

And perhaps [API Docs](https://docs.discourse.org/#tag/Users/operation/deleteUser) could use a mention of this requirement too, maybe?

---

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