Get a user's status

GET https://cdfa-phs.zulipchat.com/api/v1/users/{user_id}/status

Get the status currently set by a user in the organization.

Changes: New in Zulip 9.0 (feature level 262). Previously, user statuses could only be fetched via the POST /register endpoint.

Usage examples

#!/usr/bin/env python3

import zulip

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

# Get the status currently set by a user.
result = client.call_endpoint(
    url=f"/users/{user_id}/status",
    method="GET",
)
print(result)

curl -sSX GET -G https://cdfa-phs.zulipchat.com/api/v1/users/12/status \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY

Parameters

user_id integer required in path

Example: 12

The target user's ID.


Response

Return values

  • status: object

    The status set by the user. Note that, if the user doesn't have a status currently set, then the returned dictionary will be empty as none of the keys listed below will be present.

    • away: boolean

      If present, the user has marked themself "away".

      Changes: Deprecated in Zulip 6.0 (feature level 148); starting with that feature level, away is a legacy way to access the user's presence_enabled setting, with away = !presence_enabled. To be removed in a future release.

    • status_text: string

      If present, the text content of the user's status message.

    • emoji_name: string

      If present, the name for the emoji to associate with the user's status.

      Changes: New in Zulip 5.0 (feature level 86).

    • emoji_code: string

      If present, a unique identifier, defining the specific emoji codepoint requested, within the namespace of the reaction_type.

      Changes: New in Zulip 5.0 (feature level 86).

    • reaction_type: string

      If present, a string indicating the type of emoji. Each emoji reaction_type has an independent namespace for values of emoji_code.

      Must be one of the following values:

      • unicode_emoji : In this namespace, emoji_code will be a dash-separated hex encoding of the sequence of Unicode codepoints that define this emoji in the Unicode specification.

      • realm_emoji : In this namespace, emoji_code will be the ID of the uploaded custom emoji.

      • zulip_extra_emoji : These are special emoji included with Zulip. In this namespace, emoji_code will be the name of the emoji (e.g. "zulip").

      Changes: New in Zulip 5.0 (feature level 86).

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",
    "status": {
        "emoji_code": "1f697",
        "emoji_name": "car",
        "reaction_type": "unicode_emoji",
        "status_text": "on vacation"
    }
}

An example JSON error response when the user does not exist:

{
    "code": "BAD_REQUEST",
    "msg": "No such user",
    "result": "error"
}