POST /streams/{stream_id}/delete_topic

Delete all messages in a topic.

Topics are a field on messages (not an independent data structure), so deleting all the messages in the topic deletes the topic from Zulip.

Because this endpoint deletes messages in batches, it is possible for the request to time out after only deleting some messages in the topic. When this happens, the complete boolean field in the success response will be false. Clients should repeat the request when handling such a response. If all messages in the topic were deleted, then the success response will return "complete": true.

Changes: Before Zulip 9.0 (feature level 256), the server never sent stream op: update events with an updated first_message_id for a channel when the oldest message that had been sent to it changed.

Before Zulip 8.0 (feature level 211), if the server's processing was interrupted by a timeout, but some messages in the topic were deleted, then it would return "result": "partially_completed", along with a code field for an error string, in the success response to indicate that there was a timeout and that the client should repeat the request.

As of Zulip 6.0 (feature level 154), instead of returning an error response when a request times out after successfully deleting some of the messages in the topic, a success response is returned with "result": "partially_completed" to indicate that some messages were deleted.

Before Zulip 6.0 (feature level 147), this request did a single atomic operation, which could time out for very large topics. As of this feature level, messages are deleted in batches, starting with the newest messages, so that progress is made even if the request times out and returns an error.

Servers

Path parameters

Name Type Required Description
stream_id Integer Yes

The ID of the channel to access.

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
topic_name String Yes

The name of the topic to delete.

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.

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

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.