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

    Get a user

    You can retrieve information about a user using this API.


    HTTP request

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

    Parameters

    The following table lists the parameters that this action supports.

    Parameters
    RequiredTypeDescription

    user_id

    string

    Specifies the unique ID of the user.

    OptionalTypeDescription

    include_unread_count

    boolean

    Determines whether to include the number of unread messages of the user's group channels in the response. (Default: false)

    custom_types

    string

    Specifies a comma-separated string of one or more custom types. This string can be used to filter the user's group channels and retrieve the number of unread messages only in the filtered channels. This parameter should be specified in conjunction with include_unread_count. Urlencoding each custom type is recommended. An example of a urlencoded string is ?custom_types=urlencoded_type_1,urlencoded_type_2.

    super_mode

    string

    Restricts the search scope to retrieve only Supergroup or non-Supergroup channels. Acceptable values are all, super, and nonsuper. This parameter should be specified in conjunction with include_unread_countabove. (Default: all)

    ?include_unread_count=true&custom_types=art,sports
    

    Responses

    If successful, this action returns a user resource in the response body.

    {
        "user_id": "Tyler",
        "nickname": "SilentSoccer",
        "unread_message_count": 7,      # The total number of unread messages in the group channels with the 'art' and 'sports' custom types
        "profile_url": "https://sendbird.com/main/img/profiles/profile_11_512px.png",
        "access_token": "800284474d5d94f3e1658c6c0794872bda4f5f72",
        "is_online": false,
        "is_active": true,
        "created_at": 1581084870,
        "last_seen_at": 1581085696197,
        "discovery_keys": ["987-654-3210", "010-3456-7890"],
        "preferred_languages": ["fr", "de", "es", "ko"],    # French, German, Spanish, and Korean
        "has_ever_logged_in": true,
        "metadata": {
            "location": "Los Angeles",
            "marriage": "Y"
        }
    }
    

    Error

    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
    }