Delete a topic

Delete all messages in a topic.

POST https://society4.zulip.yocto.eu/api/v1/streams/{stream_id}/delete_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.

Usage examples

#!/usr/bin/env python3

import zulip

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

# 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
)
print(result)

curl -sSX POST https://society4.zulip.yocto.eu/api/v1/streams/1/delete_topic \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY \
    --data-urlencode 'topic_name=new coffee machine'

Parameters

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.


Response

Example response

A typical successful JSON response may look like:

{
    "msg": "",
    "result": "success"
}

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

{
    "code": "UNAUTHORIZED_PRINCIPAL",
    "msg": "Must be an organization administrator",
    "result": "error"
}