Delete a topic

This endpoint is only available to organization administrators.


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.

Changes: As of Zulip 6.0 (feature level 154), in case of timeout, a success response with "partially_completed" result will now be returned.

Before Zulip 6.0 (feature level 147), this request did a single atomic operation, which could time out for very large topics. It now deletes messages in batches, starting with the newest messages, so that progress will be made even if the request times out.

Usage examples

#!/usr/bin/env python

import zulip

# The user for this zuliprc file must be an organization administrator
client = zulip.Client(config_file="~/zuliprc-admin")

# Delete a topic given its stream_id
request = {
    "topic_name": topic,
result = client.call_endpoint(
    url=f"/streams/{stream_id}/delete_topic", method="POST", request=request

curl -sSX POST \
    --data-urlencode 'topic_name=new coffee machine'


stream_id integer required in path

Example: 1

The ID of the stream to access.

topic_name string required

Example: "new coffee machine"

The name of the topic to delete.


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"

If the request exceeds its processing time limit after having successfully marked some messages as read, response code 200 with result "partially_completed" and code "REQUEST_TIMEOUT" will be returned like this:

    "code": "REQUEST_TIMEOUT",
    "msg": "",
    "result": "partially_completed"

Error when the user does not have permission to delete topics in this organization:

    "msg": "Must be an organization administrator",
    "result": "error"