Create a data export

This endpoint is only available to organization administrators.

POST https://chat.zulip.org/api/v1/export/realm

Note: If you're the administrator of a self-hosted installation, you may be looking for the documentation on server data export and import or server backups.

Create a public or a standard data export of the organization.

This endpoint only queues the data export; it does not wait for the export to complete, which depending on the size of the organization can take anywhere from seconds to an hour. Therefore, this endpoint's success response does not describe the outcome of the export.

To find out the outcome of the export, clients should rely on the realm_export event, which is which is sent to every organization administrator immediately when the export is requested, and again once it completes or fails. Additionally, when the export succeeds, the user who requested it will receive a direct message from the Notification Bot with a link to the organization's data exports panel, where the export can be downloaded.

Changes: Prior to Zulip 10.0 (feature level 304), only public data exports could be created using this endpoint.

New in Zulip 2.1.

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")

# Create a public data export of the organization.
result = client.call_endpoint(url="/export/realm", method="POST")
print(result)

The -u line implements HTTP Basic authentication. See the Authorization header documentation for how to get those credentials for Zulip users and bots.

curl -sSX POST https://chat.zulip.org/api/v1/export/realm \
    -u EMAIL_ADDRESS:API_KEY \
    --data-urlencode export_type=full_with_consent

Parameters

export_type string optional

Example: "full_with_consent"

Whether the data export should be public, full with consent, or full without consent.

  • public = Public data only export.
  • full_with_consent = Public and private data export (with consent), which includes private data for users who have granted consent.
  • full_without_consent = All public and private data export, which includes private data for all users. This option requires the organization to have the owner_full_content_access feature enabled.

If not specified, defaults to public.

Changes: Zulip 12.0 (feature level 449) changed the type of this field from int to string with 1 being replaced by public and 2 being replaced by full_with_consent. The option full_without_consent was added for full exports without member consent.

New in Zulip 10.0 (feature level 304). Previously, all export requests were public data exports.

Must be one of: "public", "full_with_consent", "full_without_consent". Defaults to "public".


Response

Return values

  • id: integer

    The ID of the data export created.

    Changes: New in Zulip 7.0 (feature level 182).

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:

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

An example JSON error response for when the data export exceeds the maximum allowed data export size.

{
    "code": "BAD_REQUEST",
    "msg": "Please request a manual export from zulip-admin@example.com.",
    "result": "error"
}