Update a stream

PATCH https://zulip.fotosearch.com/api/v1/streams/{stream_id}

Configure the stream with the ID stream_id. This endpoint supports an organization administrator editing any property of a stream, including:

Note that an organization administrator's ability to change a private stream's permissions depends on them being subscribed to the stream.

Usage examples

#!/usr/bin/env python3

import zulip

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

# Update the stream by a given ID
request = {
    "stream_id": stream_id,
    "stream_post_policy": 2,
    "is_private": True,
}

result = client.update_stream(request)
print(result)

curl -sSX PATCH https://zulip.fotosearch.com/api/v1/streams/1 \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY \
    --data-urlencode 'description=Discuss Italian history and travel destinations.' \
    --data-urlencode new_name=Italy \
    --data-urlencode is_private=true

Parameters

stream_id integer required in path

Example: 1

The ID of the stream to access.


description string optional

Example: "Discuss Italian history and travel destinations."

The new description for the stream, in text/markdown format.

Clients should use the max_stream_description_length returned by the POST /register endpoint to determine the maximum stream description length.

Changes: Removed unnecessary JSON-encoding of this parameter in Zulip 4.0 (feature level 64).


new_name string optional

Example: "Italy"

The new name for the stream.

Clients should use the max_stream_name_length returned by the POST /register endpoint to determine the maximum stream name length.

Changes: Removed unnecessary JSON-encoding of this parameter in Zulip 4.0 (feature level 64).


is_private boolean optional

Example: true

Change whether the stream is a private stream.


is_web_public boolean optional

Example: true

Change whether the stream is a web-public stream.

Note that creating web-public streams requires the WEB_PUBLIC_STREAMS_ENABLED server setting to be enabled on the Zulip server in question, the organization to have enabled the enable_spectator_access realm setting, and the current use to have permission under the organization's create_web_public_stream_policy realm setting.

Changes: New in Zulip 5.0 (feature level 98).


history_public_to_subscribers boolean optional

Example: false

Whether the stream's message history should be available to newly subscribed members, or users can only access messages they actually received while subscribed to the stream.

Corresponds to the shared history option in documentation.

It's an error for this parameter to be false for a public or web-public stream and when is_private is false.

Changes: Before Zulip 6.0 (feature level 136), history_public_to_subscribers was silently ignored unless the request also contained either is_private or is_web_public.


is_default_stream boolean optional

Example: false

Add or remove the stream as a default stream for new users joining the organization.

Changes: New in Zulip 8.0 (feature level 200). Previously, default stream status could only be changed using the dedicated API endpoint.


stream_post_policy integer optional

Example: 2

Policy for which users can post messages to the stream.

  • 1 = Any user can post.
  • 2 = Only administrators can post.
  • 3 = Only full members can post.
  • 4 = Only moderators can post.

Changes: New in Zulip 3.0 (feature level 1), replacing the previous is_announcement_only boolean.

Defaults to 1.


message_retention_days string | integer optional

Example: "20"

Number of days that messages sent to this stream will be stored before being automatically deleted by the message retention policy. Two special string format values are supported:

  • "realm_default": Return to the organization-level setting.
  • "unlimited": Retain messages forever.

Changes: Prior to Zulip 5.0 (feature level 91), retaining messages forever was encoded using "forever" instead of "unlimited".

New in Zulip 3.0 (feature level 17).


can_remove_subscribers_group integer optional

Example: 20

ID of the user group whose members are allowed to unsubscribe others from the stream. Note that a user who is a member of the specified user group must also have access to the stream in order to unsubscribe others.

This setting can currently only be set to user groups that are system groups, except for the system groups named "role:internet" and "role:owners".

Changes: Before Zulip 8.0 (feature level 197), the can_remove_subscribers_group setting was named can_remove_subscribers_group_id.

New in Zulip 7.0 (feature level 161).


is_announcement_only boolean optional Deprecated

Example: true

Whether the stream is limited to announcements.

Changes: Deprecated in Zulip 3.0 (feature level 1). Clients should use stream_post_policy instead.


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 supplied stream does not exist:

{
    "code": "BAD_REQUEST",
    "msg": "Invalid stream ID",
    "result": "error"
}

An example JSON response for when invalid combination of stream permission parameters are passed:

{
    "code": "BAD_REQUEST",
    "msg": "Invalid parameters",
    "result": "error"
}