Get a user's subscribed channels

GET https://chat.tplegacy.net/api/v1/users/{user_id}/channels

Gets the list of channels that the target user is subscribed to.

The channel security model means only those subscribed channels to which the acting user has metadata access are returned.

For organization administrators, this is guaranteed to be all channels the target user is subscribed to, since organization administrators implicitly have metadata access to all channels.

Changes: New in Zulip 12.0 (feature level 440).

Usage examples

#!/usr/bin/env python3

import zulip

# Pass the path to your zuliprc file here.
client = zulip.Client(config_file="~/zuliprc")

# Get channel IDs a user is subscribed to.
result = client.call_endpoint(
    url=f"/users/{user_id}/channels",
    method="GET",
)
print(result)

curl -sSX GET -G https://chat.tplegacy.net/api/v1/users/12/channels \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY

Parameters

user_id integer required in path

Example: 12

The target user's ID.


Response

Return values

  • subscribed_channel_ids: (integer)[]

    IDs of the channels that the target user is subscribed to (limited by the acting user's permissions to view subscribers).

Example response(s)

Changes: As of Zulip 7.0 (feature level 167), if any parameters sent in the request are not supported by this endpoint, a successful JSON response will include an ignored_parameters_unsupported array.

A typical successful JSON response may look like:

{
    "msg": "",
    "result": "success",
    "subscribed_channel_ids": [
        3,
        5,
        10
    ]
}