Upload a channel icon

POST https://connect.suryojasvi.com/api/v1/streams/{stream_id}/icon

Upload a picture to serve as the channel's icon, replacing any picture the channel already had. Clients that display channels as conversations, in the manner of a chat app, can show it beside the channel's name.

The uploaded image is resized by the server, so clients need not do so before uploading. The maximum accepted file size is 5 MiB.

Requires the permission to administer the channel.

Changes: New in Zulip 13.0 (feature level ZF-1b00d4).

Usage examples

The -u line implements HTTP Basic authentication. See the Authorization header documentation for how to get those credentials for Zulip users and bots.

curl -sSX POST https://connect.suryojasvi.com/api/v1/streams/1/icon \
    -u EMAIL_ADDRESS:API_KEY \
    -F filename=@/path/to/icon.png

Parameters

stream_id integer required in path

Example: 1

The ID of the channel to access.


The image to upload must be provided in the request's body, as the request's only file.

Response

Return values

  • icon_url: string

    The URL of the channel's new icon.

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:

{
    "icon_url": "/user_avatars/2/channel/9/icon.png?version=2",
    "msg": "",
    "result": "success"
}

An example JSON response for when the request did not contain exactly one file:

{
    "code": "BAD_REQUEST",
    "msg": "You must upload exactly one icon.",
    "result": "error"
}

An example JSON response for when the user does not have permission to administer the channel:

{
    "code": "BAD_REQUEST",
    "msg": "You do not have permission to administer this channel.",
    "result": "error"
}