Get drafts

GET https://refl.zulipchat.com/api/v1/drafts

Fetch all drafts for the current user.

Usage examples

curl -sSX GET -G https://refl.zulipchat.com/api/v1/drafts \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY

Parameters

This endpoint does not accept any parameters.

Response

Return values

  • count: integer

    The number of drafts the user currently has. Also the number of drafts returned under "drafts".

  • drafts: (object)[]

    Returns all of the current user's drafts, in order of last edit time (with the most recently edited draft appearing first).

    • id: integer

      The unique ID of the draft. It will only used whenever the drafts are fetched. This field should not be specified when the draft is being created or edited.

    • type: string

      The type of the draft. Either unaddressed (empty string), "stream", or "private" (for one-on-one and group direct messages).

    • to: (integer)[]

      An array of the tentative target audience IDs. For channel messages, this should contain exactly 1 ID, the ID of the target channel. For direct messages, this should be an array of target user IDs. For unaddressed drafts, this is ignored, and clients should send an empty array.

    • topic: string

      For channel message drafts, the tentative topic name. For direct or unaddressed messages, this will be ignored and should ideally be the empty string. Should not contain null bytes.

    • content: string

      The body of the draft. Should not contain null bytes.

    • timestamp: integer

      A Unix timestamp (seconds only) representing when the draft was last edited. When creating a draft, this key need not be present and it will be filled in automatically by the server.

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:

{
    "count": 3,
    "drafts": [
        {
            "content": "Let's add backend support for syncing drafts.",
            "id": 1,
            "timestamp": 1595479019,
            "to": [
                3
            ],
            "topic": "sync drafts",
            "type": "stream"
        },
        {
            "content": "What if we made it possible to sync drafts in Zulip?",
            "id": 2,
            "timestamp": 1595479019,
            "to": [
                4
            ],
            "topic": "",
            "type": "private"
        },
        {
            "content": "What if we made it possible to sync drafts in Zulip?",
            "id": 3,
            "timestamp": 1595479019,
            "to": [
                4,
                10
            ],
            "topic": "",
            "type": "private"
        }
    ],
    "msg": "",
    "result": "success"
}