Mark all messages as read

POST https://chat.zulip.org/api/v1/mark_all_as_read

Marks all of the current user's unread messages as read.

Because this endpoint marks messages as read in batches, it is possible for the request to time out after only marking some messages as read. 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 were marked as read, then the success response will return "complete": true.

Changes: Deprecated; clients should use the update personal message flags for narrow endpoint instead as this endpoint will be removed in a future release.

Before Zulip 8.0 (feature level 211), if the server's processing was interrupted by a timeout, but some messages were marked as read, 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.

Before Zulip 6.0 (feature level 153), this request did a single atomic operation, which could time out with 10,000s of unread messages to mark as read. As of this feature level, messages are marked as read in batches, starting with the newest messages, so that progress is made even if the request times out. And, instead of returning an error when the request times out and some messages have been marked as read, a success response with "result": "partially_completed" is returned.

Usage examples

#!/usr/bin/env python3

import zulip

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

# Mark all of the user's unread messages as read.
result = client.mark_all_as_read()
print(result)

curl -sSX POST https://chat.zulip.org/api/v1/mark_all_as_read \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY

Parameters

This endpoint does not accept any parameters.

Response

Return values

  • complete: boolean

    Whether all unread messages were marked as read.

    Will be false if the request successfully marked some, but not all, messages as read.

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:

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