Update user group members

POST https://perestroika.zulipchat.com/api/v1/user_groups/{user_group_id}/members

Update the members of a user group. The user IDs must correspond to non-deactivated users.

Changes: Prior to Zulip 10.0 (feature level 303), group memberships of deactivated users were visible to the API and could be edited via this endpoint.

Usage examples

#!/usr/bin/env python3

import zulip

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

request = {
    "delete": user_ids_to_remove,
    "add": user_ids_to_add,
}
result = client.update_user_group_members(user_group_id, request)
print(result)

curl -sSX POST https://perestroika.zulipchat.com/api/v1/user_groups/35/members \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY \
    --data-urlencode 'add=[12, 13]' \
    --data-urlencode 'delete_subgroups=[9]' \
    --data-urlencode 'add_subgroups=[9]'

Parameters

user_group_id integer required in path

Example: 35

The ID of the target user group.


delete (integer)[] optional

Example: [10]

The list of user IDs to be removed from the user group.


add (integer)[] optional

Example: [12, 13]

The list of user IDs to be added to the user group.


delete_subgroups (integer)[] optional

Example: [9]

The list of user group IDs to be removed from the user group.

Changes: New in Zulip 10.0 (feature level 311).


add_subgroups (integer)[] optional

Example: [9]

The list of user group IDs to be added to the user group.

Changes: New in Zulip 10.0 (feature level 311).


Response

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"
}