Upload custom emoji

POST https://chat.zulip.org/api/v1/realm/emoji/{emoji_name}

This endpoint is used to upload a custom emoji for use in the user's organization. Access to this endpoint depends on the organization's configuration.

Usage examples

#!/usr/bin/env python3

import zulip

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

# Upload a custom emoji; assume `emoji_path` is the path to your image.
with open(emoji_path, "rb") as fp:
    emoji_name = "my_custom_emoji"
    result = client.call_endpoint(
        f"realm/emoji/{emoji_name}",
        method="POST",
        files=[fp],
    )
print(result)

curl -sSX POST https://chat.zulip.org/api/v1/realm/emoji/smile \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY \
    -F filename=@/path/to/img.png

Parameters

emoji_name string required in path

Example: "smile"

The name that should be associated with the uploaded emoji image/gif. The emoji name can only contain letters, numbers, dashes, and spaces. Upper and lower case letters are treated the same, and underscores (_) are treated the same as spaces (consistent with how the Zulip UI handles emoji).


As described above, the image file to upload must be provided in the request's body.

Maximum file size

The maximum file size for uploads can be configured by the administrator of the Zulip server by setting MAX_EMOJI_FILE_SIZE_MIB in the server's settings. MAX_EMOJI_FILE_SIZE_MIB defaults to 5MB.

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