Get user groups

This endpoint is only available to Members and Administrators; bots and guests cannot use this endpoint.

Fetches all of the user groups in the organization.

GET https://z.labs.greyorange.com/api/v1/user_groups

Usage examples

#!/usr/bin/env python3

import zulip

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

# Get all user groups of the realm
result = client.get_user_groups()
print(result)

curl -sSX GET -G https://z.labs.greyorange.com/api/v1/user_groups \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY

Parameters

This endpoint does not accept any parameters.

Response

Return values

  • user_groups: (object)[]

    A list of user_group objects, which contain a description, a name, their id and the list of members of the user group.

    • description: string

      The human-readable description of the user group.

    • id: integer

      The user group's integer id.

    • members: (integer)[]

      The integer user IDs of the user group members.

    • name: string

      User group name.

    • is_system_group: boolean

      Whether the user group is a system group which cannot be modified by users.

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

Example response

A typical successful JSON response may look like:

{
    "msg": "",
    "result": "success",
    "user_groups": [
        {
            "description": "Characters of Hamlet",
            "id": 1,
            "is_system_group": false,
            "members": [
                3,
                4
            ],
            "name": "hamletcharacters"
        },
        {
            "description": "Moderators",
            "id": 2,
            "is_system_group": true,
            "members": [
                1,
                2
            ],
            "name": "other users"
        }
    ]
}