Delete an attachment
Delete an uploaded file given its attachment ID.
Note that uploaded files that have been referenced in at least
one message are automatically deleted once the last message
containing a link to them is deleted (whether directly or via
a message retention policy).
Uploaded files that are never used in a message are
automatically deleted a few weeks after being uploaded.
Attachment IDs can be contained from GET /attachments.
# Pass the path to your zuliprc file here.
client = zulip.Client(config_file="~/zuliprc")
# Delete the attachment with given attachment_id.
url = "attachments/" + str(attachment_id)
result = client.call_endpoint(
curl -sSX DELETE https://wikimedia.zulipchat.com/api/v1/attachments/1 \
attachment_id string required in path
The ID of the attachment to be deleted.
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
A typical successful JSON response may look like:
A typical failed JSON response for when the
attachment_id is invalid
"msg": "Invalid attachment",
A typical failed JSON response for when the user is not logged in
"msg": "Not logged in: API authentication or user session required",