Delete a user's avatar

This endpoint is only available to organization administrators.

DELETE https://your-org.chat.lgprk.ru/api/v1/users/{email}/avatar

Reset another user's profile picture to the default Gravatar image, identified by email. This endpoint is available to organization administrators, including bots with the administrator role.

The email may be the user's real delivery_email (if the requester is allowed to see it) or the dummy address user{id}@{realm.host}. This follows the same lookup rules as GET /users/{email}.

Administrators can reset a user's avatar even if avatar changes are disabled for the organization.

Changes: New in Zulip 11.0 (feature level 422).

Usage examples

#!/usr/bin/env python

import zulip

# The user for this zuliprc file must be an organization administrator
client = zulip.Client(config_file="~/zuliprc-admin")

# Reset another user's avatar to Gravatar. Requires administrator privileges.
result = client.call_endpoint(
    url=f"/users/{email}/avatar",
    method="DELETE",
)
print(result)

curl -sSX DELETE https://your-org.chat.lgprk.ru/api/v1/users/hamlet@zulip.com/avatar \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY

Parameters

email string required in path

Example: "hamlet@zulip.com"

The email address of the user whose avatar should be reset. Two forms are supported:

  • The real email address of the user (delivery_email). The lookup will succeed if and only if the user exists and their email address visibility setting permits the client to see it.

  • The dummy Zulip API email address of the form user{user_id}@{realm_host}.


Response

Return values

  • avatar_url: string

    The URL of the user's avatar after resetting it to Gravatar.

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:

{
    "avatar_url": "https://secure.gravatar.com/avatar/6d8cad0fd00256e7b40691d27ddfd466?d=identicon&version=2",
    "msg": "",
    "result": "success"
}

An example JSON error response when the requester is not an organization administrator:

{
    "code": "UNAUTHORIZED_PRINCIPAL",
    "msg": "Must be an organization administrator",
    "result": "error"
}

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

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