Stream Chat icon

Stream Chat

Server-side Stream Chat operations

Channel → Ban User

AI-generated

Summary

Ban a specified user from a given chat channel for a configurable duration with an optional reason.

Inputs

  • Channel Type — Type of the channel, such as "messaging" (1-on-1 chats), "team" (group channels), or "livestream" (broadcast channels). Defaults to "messaging".
  • Channel ID (required) — Unique identifier of the target channel (e.g., "general", "random", "team-alpha"). Combined with Channel Type to identify the channel.
  • Target User ID (required) — ID of the user to ban from the channel.
  • Ban Reason — Optional reason explaining why the user is being banned.
  • Ban Timeout (Minutes) — Duration of the ban in minutes; minimum is 1. Defaults to 60 minutes.

Output shape

A single JSON object representing the result of the ban operation as returned by the Stream Chat API.

The operation will perform a server-side ban of the target user on the specified channel. The returned JSON typically includes the updated channel state or ban confirmation. Moderation changes may take a few seconds to propagate across Stream Chat servers.

Examples

Example 1: Ban user 'user123' from the 'team-alpha' team channel for 120 minutes with reason 'Violation of rules'

Set Channel Type to 'team', Channel ID to 'team-alpha', Target User ID to 'user123', Ban Timeout (Minutes) to 120, and Ban Reason to 'Violation of rules'.

Discussion