Chat / Platform API
Current version: v3
    Chat Platform API v3
    Chat Platform API
    Chat
    Platform API
    Home
    /
    Chat
    /
    Platform API
    /
    Channel

    Leave a channel

    This action allows one or more members to leave a group channel. To let a user leave all of their group channels at once, use the leave group channels API instead.

    Since this API can't be called for a deactivated user, ensure that the leave_all_when_deactivated property of the user is set to its default value of true to let the user leave all joined group channels upon deactivation.


    HTTP request

    PUT https://api-{application_id}.sendbird.com/v3/group_channels/{channel_url}/leave
    

    Parameters

    The following table lists the parameters that this action supports.

    Required
    Parameter nameTypeDescription

    channel_url

    string

    Specifies the URL of a channel.


    Request body

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

    Properties
    RequiredTypeDescription

    user_ids[]

    array of strings

    Specifies an array of one or more unique IDs of members to leave the channel.

    OptionalTypeDescription

    should_leave_all

    boolean

    Determines whether to have all members leave the channel. If set to true, makes all members leave the channel. (Default: false)

    should_remove_operator_status

    boolean

    Determines whether to remove a user from the channel's operator list if the user who is leaving the channel is an operator. (Default: false)

    reason

    string

    Specifies the reason for leaving a channel. Acceptable values are admin_removed, admin_deleted, admin_deactivated, left_by_own_choice, and channel_operator_removed.

    {
        "user_ids": ["Philip", "Matthew", "Janna"]
    }
    

    Responses

    If successful, this action returns an empty response body.

    Error

    In the case of an error, an error object like below is returned. See the error codes section for more details.

    {
        "message": "\"Joined users were not found in the provided user\" not found.",
        "code": 400201,
        "error": true
    }