/ Platform API
Platform API
    Chat Platform API v3
    Chat Platform API
    Chat Platform API
    Version 3

    Ban a member from a group channel

    Copy link

    Bans a member from a group channel. A banned member is immediately expelled from a channel and is allowed to join the channel again only after a set period of time has passed.

    Note: To learn more about other available moderation tools, see Moderation Overview.


    HTTP request

    Copy link
    POST https://api-{application_id}.sendbird.com/v3/group_channels/{channel_url}/ban
    

    Parameters

    Copy link

    The following table lists the parameters that this action supports.

    Required
    Parameter nameTypeDescription

    channel_url

    string

    Specifies the URL of a channel.


    Request body

    Copy link

    The following table lists the properties of an HTTP request that this action supports.

    Properties
    RequiredTypeDescription

    user_id

    string

    Specifies the unique ID of a user.

    OptionalTypeDescription

    agent_id

    string

    Specifies the ID of an operator who bans a user.

    seconds

    int

    Specifies the duration of ban in seconds. If set to -1, a user will be banned for ten years, which refers to a permanent ban on the Sendbird Dashboard. (Default: -1)

    description

    string

    Specifies the reason for ban. The maximum length is 250 characters.

    {
        "user_id": "John",
        "seconds": 60,
        "description": "Too much talking"
    }
    

    Response

    Copy link

    If successful, this action returns the banned user resource and ban information in the response body.

    {
        "user": {
            "user_id": "John",
            "nickname": "Sendbirdian",
            "profile_url": "https://sendbird.com/main/img/profiles/profile_02_512px.png",
            "metadata": {
                "font_preference": "times new roman",
                "font_color": "black"
            }
        },
        "start_at": 1543211671000,
        "end_at": 1543211731000,
        "description": "Too much talking"
    }
    

    List of response properties

    Copy link
    Property nameTypeDescription

    user

    object

    The user resource that contains brief information about the banned user.

    start_at

    long

    The time when the user becomes banned in the channel. The value is in Unix milliseconds format.

    end_at

    long

    The timestamp of when the ban is scheduled to end. The value is in Unix milliseconds format.

    description

    string

    The reason for ban.

    In the case of an error, an error object is returned. A detailed list of error codes is available here.