Stream provides moderation APIs for flagging content, muting users, banning users, and blocking users. These actions integrate with the moderation review queue and dashboard. All endpoints use the v2 moderation API and are available through Stream's server-side SDKs.
Flagging allows users or moderators to report content for review. Flagged content is automatically added to the moderation review queue. You can flag messages, users, activities, reactions, or any custom entity type.
Use the flag method to report an entity for moderation review. You can attach a reason, custom metadata, and a moderation payload containing the content to be reviewed.
await client.moderation.flag({ entity_type: "stream:chat:v1:message", entity_id: messageId, entity_creator_id: creatorId, reason: "spam", custom: { user_comment: "This user is spamming the channel" }, user_id: moderatorId,});
client.moderation().flag( entity_type="stream:chat:v1:message", entity_id=message_id, entity_creator_id=creator_id, reason="spam", custom={"user_comment": "This user is spamming the channel"}, user_id=moderator_id,)
client.Moderation().Flag(ctx, &getstream.FlagRequest{ EntityType: "stream:chat:v1:message", EntityID: messageId, EntityCreatorID: getstream.PtrTo(creatorId), Reason: getstream.PtrTo("spam"), Custom: map[string]interface{}{ "user_comment": "This user is spamming the channel", }, UserID: getstream.PtrTo(moderatorId),})
client.moderation().flag(FlagRequest.builder() .entityType("stream:chat:v1:message") .entityID(messageId) .entityCreatorID(creatorId) .reason("spam") .custom(Map.of("user_comment", "This user is spamming the channel")) .userId(moderatorId) .build()).execute();
$client->moderation()->flag(new FlagRequest( entityType: 'stream:chat:v1:message', entityID: $messageId, entityCreatorID: $creatorId, reason: 'spam', custom: (object)['user_comment' => 'This user is spamming the channel'], userID: $moderatorId,));
client.moderation.flag(GetStream::Generated::Models::FlagRequest.new( entity_type: "stream:chat:v1:message", entity_id: message_id, entity_creator_id: creator_id, reason: "spam", custom: { "user_comment" => "This user is spamming the channel" }, user_id: moderator_id))
await client.Moderation.FlagAsync(new FlagRequest{ EntityType = "stream:chat:v1:message", EntityID = messageId, EntityCreatorID = creatorId, Reason = "spam", Custom = new Dictionary<string, object> { { "user_comment", "This user is spamming the channel" } }, UserID = moderatorId,});
Request parameters
key
required
type
description
entity_type
true
string
Type of entity being flagged. Examples: stream:chat:v1:message, stream:user, stream:feeds:v2:activity, stream:feeds:v2:reaction, or any custom type.
entity_id
true
string
Unique identifier of the entity being flagged.
entity_creator_id
false
string
User ID of the entity creator.
reason
false
string
Reason for flagging. Use a slug or keyword for easy filtering.
custom
false
object
Custom metadata to attach to the flag.
moderation_payload
false
object
Content to be reviewed (texts, images, videos). Displayed on the dashboard.
user_id
false
string
User ID of the person flagging (required for server-side usage).
Muting allows users to silence other users. Muted users' messages are still delivered via WebSocket but not via push notifications (APN/Firebase). Implementing UI logic for muted users (hiding or displaying differently) is left to the developer.
Banning prevents a user from posting messages. Users can be banned from a specific channel or from the entire app. Bans support timeouts (temporary bans), shadow banning, IP banning, and optional message deletion.
Ban a user from a specific channel by providing the channel_cid parameter. The user will still be able to use the rest of the app.
await client.moderation.ban({ target_user_id: "user_to_ban", banned_by_id: moderatorId, channel_cid: "messaging:general", reason: "Trolling in this channel", timeout: 60,});
client.moderation().ban( target_user_id="user_to_ban", banned_by_id=moderator_id, channel_cid="messaging:general", reason="Trolling in this channel", timeout=60,)
client.Moderation().Ban(ctx, &getstream.BanRequest{ TargetUserID: "user_to_ban", BannedByID: getstream.PtrTo(moderatorId), ChannelCID: getstream.PtrTo("messaging:general"), Reason: getstream.PtrTo("Trolling in this channel"), Timeout: getstream.PtrTo(60),})
client.moderation().ban(BanRequest.builder() .targetUserID("user_to_ban") .bannedByID(moderatorId) .channelCID("messaging:general") .reason("Trolling in this channel") .timeout(60) .build()).execute();
$client->moderation()->ban(new BanRequest( targetUserID: 'user_to_ban', bannedByID: $moderatorId, channelCID: 'messaging:general', reason: 'Trolling in this channel', timeout: 60,));
client.moderation.ban(GetStream::Generated::Models::BanRequest.new( target_user_id: "user_to_ban", banned_by_id: moderator_id, channel_cid: "messaging:general", reason: "Trolling in this channel", timeout: 60))
Shadow banning allows a user to continue posting, but their messages are only visible to themselves. Other users will not see the shadow-banned user's messages. This is useful for handling disruptive users without alerting them.
Enable or disable moderation bypass for a specific user, allowing them to skip content moderation checks. This is a server-side only operation intended for trusted users whose content should not be subject to automated moderation.