Skip to content

user_ban

Ban a member from the server. A banned user is disconnected at once and can’t sign in again until someone runs user_unban.

{
"cmd": "user_ban",
"user": "alice"
}
Field Type Required Description
user string Yes Username or user ID. Matching ignores letter case and a leading @.
{
"cmd": "user_ban",
"user": "alice",
"banned": true
}

banned is true only when this request changed something:

  • If the user was already banned, you get their username and banned: false.
  • If no account matches, you get user: null and banned: false. This is not an error.

A ban adds the banned role to the front of the user’s role list and records an entry in the audit log. When a ban takes effect:

  1. Every session of the banned user receives an auth_error frame, then closes.

    {
    "cmd": "auth_error",
    "val": "You have been banned from this server",
    "reason": "banned"
    }
  2. Every authenticated connection, including yours, receives { "cmd": "user_leave", "username": "alice" }.

Banned users drop out of users_list and show up in users_banned. Their messages stay.

Requires manage_users. It is blocked while you are timed out.

val When
Cannot ban the server owner The target has the owner role.
Unable to save users The server could not write the change to storage.
Validation message user is missing, not a string, or blank.