Mute a user

POST https://zulip.imolainformatica.it/api/v1/users/me/muted_users/{muted_user_id}

This endpoint mutes a user. Messages sent by users you've muted will be automatically marked as read and hidden.

Muted users should be implemented by clients as follows:

  • The server will immediately mark all messages sent by the muted user as read. This will automatically clear any existing mobile push notifications related to the muted user.
  • The server will mark any new messages sent by the muted user as read for your account, which prevents all email and mobile push notifications.
  • Clients should exclude muted users from presence lists or other UI for viewing or composing 1:1 private messages. 1:1 private messages sent by muted users should be hidden everywhere in the Zulip UI.
  • Stream messages and group private messages sent by the muted user should avoid displaying the content and name/avatar, but should display that N messages by a muted user were hidden (so that it is possible to interpret the messages by other users who are talking with the muted user).
  • Group private message conversations including the muted user should display muted users as "Muted user", rather than showing their name, in lists of such conversations, along with using a blank grey avatar where avatars are displayed.
  • Administrative/settings UI elements for showing "All users that exist on this stream or realm", e.g. for organization administration or showing stream subscribers, should display the user's name as normal.

Changes: New in Zulip 4.0 (feature level 48).

Usage examples

#!/usr/bin/env python3

import zulip

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

# Mute user with ID 10
muted_user_id = 10
result = client.call_endpoint(url=f"/users/me/muted_users/{muted_user_id}", method="POST")
print(result)

curl -sSX POST https://zulip.imolainformatica.it/api/v1/users/me/muted_users/10 \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY

Parameters

muted_user_id integer required in path

Example: 10

The ID of the user to mute/un-mute.


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

An example JSON response for when the user is yourself:

{
    "msg": "Cannot mute self",
    "result": "error"
}

An example JSON response for when the user is nonexistent or inaccessible:

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

An example JSON response for when the user is already muted:

{
    "msg": "User already muted",
    "result": "error"
}