Get subscription status

Check whether a user is subscribed to a stream.

GET https://electron-builder.zulipchat.com/api/v1/users/{user_id}/subscriptions/{stream_id}

Changes: New in Zulip 3.0 (feature level 11).

Usage examples

#!/usr/bin/env python3

import zulip

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

# Check whether a user is a subscriber to a given stream.
user_id = 7
stream_id = 1
result = client.call_endpoint(
    url=f'/users/{user_id}/subscriptions/{stream_id}',
    method='GET',
)
print(result)

curl -sSX GET -G https://electron-builder.zulipchat.com/api/v1/users/7/subscriptions/1 \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY

Parameters

user_id required in path

Example: 7

The target user's ID.


stream_id required in path

Example: 1

The ID of the stream to access.


Response

Example response

A typical successful JSON response may look like:

{
    "is_subscribed": false,
    "msg": "",
    "result": "success"
}