PATCH /messages/{message_id}

Update the content, topic, or channel of the message with the specified ID.

You can resolve topics by editing the topic to ✔ {original_topic} with the propagate_mode parameter set to "change_all".

See configuring message editing for detailed documentation on when users are allowed to edit message content, and restricting moving messages for detailed documentation on when users are allowed to change a message's topic and/or channel.

The relevant realm settings in the API that are related to the above linked documentation on when users are allowed to update messages are:

More details about these realm settings can be found in the POST /register response or in the documentation of the realm op: update_dict event in GET /events.

Changes: Prior to Zulip 10.0 (feature level 367), the permission for resolving a topic was managed by can_move_messages_between_topics_group. As of this feature level, users belonging to the can_resolve_topics_group will have the permission to resolve topics in the organization.

In Zulip 10.0 (feature level 316), edit_topic_policy was removed and replaced by can_move_messages_between_topics_group realm setting.

Changes: In Zulip 10.0 (feature level 310), move_messages_between_streams_policy was removed and replaced by can_move_messages_between_channels_group realm setting.

Prior to Zulip 7.0 (feature level 172), anyone could add a topic to channel messages without a topic, regardless of the organization's topic editing permissions. As of this feature level, messages without topics have the same restrictions for topic edits as messages with topics.

Before Zulip 7.0 (feature level 172), by using the change_all value for the propagate_mode parameter, users could move messages after the organization's configured time limits for changing a message's topic or channel had passed. As of this feature level, the server will return an error with "code": "MOVE_MESSAGES_TIME_LIMIT_EXCEEDED" if users, other than organization administrators or moderators, try to move messages after these time limits have passed.

Before Zulip 7.0 (feature level 162), users who were not administrators or moderators could only edit topics if the target message was sent within the last 3 days. As of this feature level, that time limit is now controlled by the realm setting move_messages_within_stream_limit_seconds. Also at this feature level, a similar time limit for moving messages between channels was added, controlled by the realm setting move_messages_between_streams_limit_seconds. Previously, all users who had permission to move messages between channels did not have any time limit restrictions when doing so.

Before Zulip 7.0 (feature level 159), editing channels and topics of messages was forbidden if the realm setting for allow_message_editing was false, regardless of an organization's configuration for the realm settings edit_topic_policy or move_messages_between_streams_policy.

Before Zulip 7.0 (feature level 159), message senders were allowed to edit the topic of their messages indefinitely.

In Zulip 5.0 (feature level 75), the edit_topic_policy realm setting was added, replacing the allow_community_topic_editing boolean.

In Zulip 4.0 (feature level 56), the move_messages_between_streams_policy realm setting was added.

Servers

Path parameters

Name Type Required Description
message_id Integer Yes

The target message's ID.

Request headers

Name Type Required Description
Content-Type String Yes The media type of the request body.

Default value: "application/x-www-form-urlencoded"

Request body fields

Name Type Required Description
propagate_mode String No

Which message(s) should be edited:

  • "change_later": The target message and all following messages.
  • "change_one": Only the target message.
  • "change_all": All messages in this topic.

Only the default value of "change_one" is valid when editing only the content of a message.

This parameter determines both which messages get moved and also whether clients that are currently narrowed to the topic containing the message should navigate or adjust their compose box recipient to point to the post-edit channel/topic.

Valid values:

  • "change_one"
  • "change_later"
  • "change_all"

Default value: "change_one"

stream_id Integer No

The channel ID to move the message(s) to, to request moving messages to another channel.

Should only be sent when changing the channel, and will throw an error if the target message is not a channel message.

Note that a message's content and channel cannot be changed at the same time, so sending both content and stream_id parameters will throw an error.

Changes: New in Zulip 3.0 (feature level 1).

topic String No

The topic to move the message(s) to, to request changing the topic.

Clients should use the max_topic_length returned by the POST /register endpoint to determine the maximum topic length

Should only be sent when changing the topic, and will throw an error if the target message is not a channel message.

Note: When the value of realm_empty_topic_display_name found in the POST /register response is used for this parameter, it is interpreted as an empty string.

When topics are required, this parameter can't be "(no topic)", an empty string, or the value of realm_empty_topic_display_name.

You can resolve topics by editing the topic to ✔ {original_topic} with the propagate_mode parameter set to "change_all". The empty string topic cannot be marked as resolved.

Changes: Before Zulip 10.0 (feature level 334), empty string was not a valid topic name for channel messages.

New in Zulip 2.0.0. Previous Zulip releases encoded this as subject, which is currently a deprecated alias.

send_notification_to_new_thread Boolean No

Whether to send an automated message to the new topic to notify users where the messages came from.

If the move is just resolving/unresolving a topic, this parameter will not trigger an additional notification.

Changes: Before Zulip 6.0 (feature level 152), this parameter was ignored unless the channel was changed.

New in Zulip 3.0 (feature level 9).

Default value: true

send_notification_to_old_thread Boolean No

Whether to send an automated message to the old topic to notify users where the messages were moved to.

Changes: Before Zulip 6.0 (feature level 152), this parameter had a default of true and was ignored unless the channel was changed.

New in Zulip 3.0 (feature level 9).

Default value: false

prev_content_sha256 String No

An optional SHA-256 hash of the previous raw content of the message that the client has at the time of the request.

If provided, the server will return an error if it does not match the SHA-256 hash of the message's content stored in the database.

Clients can use this feature to prevent races where multiple clients save conflicting edits to a message.

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

content String No

The updated content of the target message.

Clients should use the max_message_length returned by the POST /register endpoint to determine the maximum message size.

Note that a message's content and channel cannot be changed at the same time, so sending both content and stream_id parameters will throw an error.

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. Search for the API you want to integrate with and click on the name.
    • This loads the API reference documentation and prepares the Http request settings.
  3. Click Test request to test run your request to the API and see the API's response.