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

    List blocked by and blocking users

    Copy link

    This action retrieves a list of users who are either blocked by a specific user or a list of users who are blocking a specific user.


    HTTP request

    Copy link
    GET https://api-{application_id}.sendbird.com/v3/users/{user_id}/block
    

    Parameters

    Copy link

    The following table lists the parameters that this action supports.

    Parameters
    RequiredTypeDescription

    user_id

    string

    Specifies the unique ID of the user.

    OptionalTypeDescription

    list

    string

    Specifies whether to retrieve a list of users who are blocked by the specified user or a list of users who are blocking the specified user. Acceptable values are blocked_by_me and blocking_me. The "me" in the values refers to the user specified in the parameter. (Default: blocked_by_me)

    token

    string

    Specifies a page token that indicates the starting index of results to retrieve. If not specified, the index is set as 0.

    limit

    int

    Specifies the number of results to return per page. Acceptable values are 1 to 100, inclusive. (Default: 10)

    user_ids

    string

    Specifies the user IDs of the blocked or blocking users to search for. The value should be a comma-separated string that consists of multiple URL encoded user IDs.

    metadatakey

    string

    Specifies a keyword to search for. The keyword acts as a filter to search for blocked or blocking users with metadata containing the keyword as a key. This parameter should be specified in conjunction with the metadatavalues_in parameter below.

    metadatavalues_in

    string

    Specifies a keyword to search for. The keyword acts as a filter to search for blocked or blocking users with metadata containing the keyword in its values. This parameter works in conjunction with the key specified by the metadatakey parameter above. The value of metadatakey must match one or more values specified by this parameter. The string should be specified with multiple URL encoded metadata values separated by commas.

    ?list=blocked_by_me&token=BFRTAQBTQlWeEUBXWFNeF1E2FEdFRF~~&limit=3&metadatakey=font_color&metadatavalues_in=black
    

    Responses

    Copy link

    If successful, this action returns a list of user resources in the response body.

    {
        "users": [
            {
                "user_id": "Tom",
                "nickname": "MissionImpossible",
                "profile_url": "https://sendbird.com/main/img/profiles/profile_26_512px.png",
                "is_online": false,
                "last_seen_at": 2001604082551,
                "metadata": {
                    "font_preference": "times new roman",
                    "font_color": "black"
                }
            },
            {
                "user_id": "Kelly",
                "nickname": "Traveler",
                "profile_url": "https://sendbird.com/main/img/profiles/profile_42_512px.png",
                "is_online": true,
                "last_seen_at": 0,
                "metadata": {
                    "font_preference": "times new roman",
                    "font_color": "black"
                }
            }
        ],
        "next": "AQdfe45fs1AIEUYXX1RcE2d0FUZSUlkJFVQRHB86AkAgNn8eABABFeA3X11fUl34df31"
    }
    

    List of response properties

    Copy link
    Property nameTypeDescription

    users[]

    array of objects

    An array of users who are either blocked by the specified user or are blocking the specified user.

    next

    string

    The value that can be used in the token parameter to retrieve the next page in the result set.

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

    {
        "message": "\"User\" not found.",
        "code": 400201,
        "error": true
    }