---
id: moderation_tools
sidebar_position: 23
title: Moderation Tools
---

### Flag

Any user is allowed to flag a message.
Flagging does not perform any particular action on the chat.
The API will only trigger the related webhook event and make the message appear on your Stream Dashboard Chat Moderation view.

```dart
await client.flagMessage("messageID");
```

### Mutes

Any user is allowed to mute another user.
Mutes are stored at user level and returned with the rest of the user information when connectUser is called.
A user will be be muted until the user is unmuted or the mute is expired.

```dart
await client.muteUser("eviluser");

await client.unmuteUser("eviluser");
```

After muting a user messages will still be delivered via web-socket.
Implementing business logic such as hiding messages from muted users or display them differently is left to the developer to implement.

Messages from muted users are not delivered via push (APN/Firebase)

### Ban

Users can be banned from an app entirely or from a channel. When a user is banned, they will not be allowed to post messages until the ban is removed or expired but will be able to connect to Chat and to channels as before.

Users must be a member of a channel to be banned from that channel. Channel watchers cannot be banned.

It is also possible to ban the user's last known IP address to prevent creation of new "throw-away" accounts. This type of ban is only applicable on the app level. We do not recommend applying IP ban without reasonable timeout, however this is not restricted. The IP address will be unbanned either after reaching a timeout or with explicit user unban.

In most cases only admins or moderators are allowed to ban other users from a channel.

```dart
// ban a user for 60 minutes from all channel
await client.banUser('eviluser', {
    'banned_by_id': userID, // ID of the user who is performing the ban (Server-side auth)
    'timeout': 60,
    'reason': 'Banned for one hour',
});

// ban a user and their IP address for 24 hours
 await client.banUser('eviluser', {
   'banned_by_id': userID,
   'timeout': 24*60,
   'ip_ban':  true,
   'reason': 'Please come back tomorrow',
});

// ban a user from the livestream:fortnite channel
await channel.banUser('eviluser', {
   'banned_by_id': userID,
   'reason': 'Profanity is not allowed here',
});

// remove ban from channel
await channel.unbanUser('eviluser');

// remove global ban
await authClient.unbanUser('eviluser');
```

### Query Banned Users

Banned users can be retrieved in different ways:

Using the dedicated query bans endpoint
User Search: you can add the banned:true condition to your search. Please note that this will only return users that were banned at the app-level and not the ones that were banned only on channels.

```dart
// retrieve the list of banned users
    await client.queryUsers(filter: Filter.equal('banned', true), pagination: PaginationParams(limit:10, offset:0));
```

### Shadow Ban

Users can be shadow banned from a channel, set of channels, or an entire app. When a user is shadow banned, they will still be allowed to post messages, but any message sent during the ban, will have the shadowed: true field set; this will be invisible from the author of the message.

You will need to implement UI logic for how your application will handle shadowed messages. Having the client hide these messages for everybody other than the user sending them is a common approach.

```dart
// shadow ban a user from all channels
await client.shadowBan('eviluser');

// shadow ban a user from a channel
await channel.shadowBan('eviluser');

// remove shadow ban from channel
await channel.removeShadowBan('eviluser');

// remove global shadow ban
await client.removeShadowBan('eviluser');
Administrators can view shadow banned user status in queryChannels(), queryMembers() and queryUsers().
```

### Block Lists

A list of words you can define to moderate chat messages.
A block list can be assigned to each channel type to either block or flag messages that contain these words.
More information can be found [here](https://getstream.io/chat/docs/react/block_lists/?language=dart).

### Advanced Chat Moderation

Advanced Chat Moderation is currently in beta and accepting trial candidates. Please contact support to discuss your options.
Advanced Chat Moderation uses an AI-based classification system to detect various types of bad content.
The tool is powered by a machine learning model that provides a confidence interval (0-1) for a message,
in each of three categories: Spam, Explicit and Toxic.
The model is highly configurable for each channel type and removes the manual work of a human moderator. You can learn more [here](https://getstream.io/chat/docs/react/advanced_moderation_beta/?language=dart).