Platform docs
Auth, users, webhooks & more

Exporting Data

Export channels and users to retrieve messages, metadata, and associated data. All exports run asynchronously and return a task ID for tracking status.

Note:

All export endpoints require server-side authentication.

Exporting Channels

var response = await chat.ExportChannelsAsync(new ExportChannelsRequest
{
    Channels = new List<ChannelExport>
    {
        new ChannelExport
        {
            ID = "white-room",
            Type = "livestream",
            MessagesSince = new DateTime(2020, 11, 10, 9, 30, 0, DateTimeKind.Utc),
            MessagesUntil = new DateTime(2020, 11, 10, 11, 30, 0, DateTimeKind.Utc),
        },
    },
    IncludeTruncatedMessages = true,
});

var taskId = response.Data.TaskID;

Channel Export Options

Parameter Description
type Channel type (required)
id Channel ID (required)
messages_since Export messages after this timestamp (RFC3339 format)
messages_until Export messages before this timestamp (RFC3339 format)
include_truncated_messages Include messages that were truncated (default: false)
include_soft_deleted_channels Include soft-deleted channels (default: false)
version Export format: v1 (default) or v2 (line-separated JSON)
Info:

A single request can export up to 25 channels.

Export Format (v2)

Add version: "v2" for line-separated JSON output, where each entity appears on its own line.

var response = await chat.ExportChannelsAsync(new ExportChannelsRequest
{
    Channels = new List<ChannelExport>
    {
        new ChannelExport
        {
            ID = "white-room",
            Type = "livestream",
        },
    },
    Version = "v2",
});

Checking Export Status

Poll the task status using the returned task ID. When the task completes, the response includes a URL to download the JSON export file.

var response = await client.GetTaskAsync(taskId);

Console.WriteLine(response.Data.Status);          // Task status
Console.WriteLine(response.Data.Result);          // Result object (when completed)
Console.WriteLine(response.Data.Result["url"]);   // Download URL
Console.WriteLine(response.Data.Error);           // Error description (if failed)
Info:
  • Download URLs expire after 24 hours but are regenerated on each status request
  • Export files remain available for 60 days
  • Timestamps use UTC in RFC3339 format (e.g., 2021-02-17T08:17:49.745857Z)

Exporting Users

Export user data including messages, reactions, calls, and custom data. The export uses line-separated JSON format (same as channel export v2).

var exportResponse = await client.ExportUsersAsync(new ExportUsersRequest
{
    UserIds = new List<string> { "user-id-1", "user-id-2" },
});
var taskId = exportResponse.Data.TaskID;
Info:

A single request can export up to 25 users with a maximum of 10,000 messages per user. Contact support to export users with more than 10,000 messages.

Filtering by channel and time

By default, a user export contains everything the user has. To export only part of it, for example the messages a user sent in one channel during one month, add one or more of these optional fields:

Parameter Description
channel_cids Export only data from these channels, as type:id CIDs (for example messaging:general). Up to 100 channels.
messages_from Start of the time window, inclusive. Messages created at or after this timestamp are exported (RFC3339 format). Also applies to reactions.
messages_to End of the time window, exclusive. Messages created before this timestamp are exported (RFC3339 format). Also applies to reactions.

Each field can be used on its own. When you set both messages_from and messages_to, a message is exported when messages_from <= created_at < messages_to.

var exportResponse = await client.ExportUsersAsync(new ExportUsersRequest
{
    UserIds = new List<string> { "user-id-1" },
    ChannelCids = new List<string> { "messaging:general" },
    MessagesFrom = new DateTime(2026, 1, 1, 0, 0, 0, DateTimeKind.Utc),
    MessagesTo = new DateTime(2026, 2, 1, 0, 0, 0, DateTimeKind.Utc),
});
var taskId = exportResponse.Data.TaskID;

How the filters apply:

  • Every user. The filters apply to every user in user_ids.
  • Messages. Only messages that match the channel and time filters are exported. Thread replies and soft-deleted messages are included when they match.
  • Reactions. Reactions are selected by the time they were added, using the same window, and by the channel of the message they belong to. A reaction added in February to a January message is in a February export, not a January one.
  • Polls. Polls follow the exported messages: a poll is exported when an exported message contains it.
  • Calls. Calls are left out of the export when any of the three fields is set, because a call has no channel or message time to filter on.
  • User record. The user record itself is always exported.
  • Limits. The limits of 10,000 messages and 1,000 reactions per user count only what matches the filters. Messages are read newest first, so an export that reaches the message limit leaves out the oldest matching messages. Reactions are read oldest first, so an export that reaches the reaction limit leaves out the newest matching reactions. To export a longer period in full, split it into several windows.
Tip:

Because messages_from is inclusive and messages_to is exclusive, back-to-back windows (for example January 1 to February 1, then February 1 to March 1) don't overlap and don't miss messages.

The request fails with a 400 error when:

  • channel_cids is set to an empty list. Leave the field out to export all channels.
  • channel_cids has more than 100 entries.
  • An entry in channel_cids isn't a type:id CID with exactly one :.
  • messages_to is not after messages_from.

Checking Export Status

var taskStatus = await client.GetTaskAsync(taskId);
if (taskStatus.Data.Status == "completed")
{
    var exportedFileUrl = taskStatus.Data.Result["url"].ToString();
}