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

    Ban users from channels by a custom channel type

    Copy link

    Bans users from channels with the specified custom channel type at once.

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


    HTTP Request

    Copy link
    POST https://api-{application_id}.sendbird.com/v3/applications/settings_by_channel_custom_type/{custom_type}/ban
    

    Parameters

    Copy link

    The following table lists the parameters that this action supports.

    Required
    Parameter nameTypeDescription

    custom_type

    string

    Specifies a custom channel type.


    Request body

    Copy link

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

    Properties
    RequiredTypeDescription

    banned_list[]

    array of objects

    An array of JSON objects that contain information on banned users.

    (ban).user_id

    string

    Specifies the unique ID of a user.

    OptionalTypeDescription

    (ban).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)

    (ban).description

    string

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

    on_demand_upsert

    boolean

    Determines whether the Sendbird system should create new users to ban if there are no users with the IDs specified in user_ids. If this property is set to true and the value of user_ids contain user IDs that don't exist in the Sendbird application, this API creates new users according to the user IDs specified in user_ids and bans both existing and new users. If false, only existing users are banned.(Default: false)

    * The on_demand_user_upsert property can be used interchangeably with this property.

    {
        "banned_list": [
            {
                "user_id": "Joe",
                "seconds": 600,
                "description": "Too many messages"
            },
            {
                "user_id": "Harry",
                "seconds": 1000,
                "description": "Not good manner"
            },
            {
                "user_id": "Jeff",
                "seconds": 200,
                "description": "Short penalty"
            }
        ],
        "on_demand_upsert": true
    }
    

    Response

    Copy link

    If successful, this action returns an empty response body.

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