# Exporting Data

Export channels and users to retrieve messages, metadata, and associated data. All exports run [asynchronously](https://getstream.io/docs/platform/async-operations/) and return a task ID for tracking status.

<Admonition type="note">

All export endpoints require server-side authentication.

</Admonition>

## Exporting Channels

```python label="Python"
from getstream.models import ChannelExport

# Export a single channel
response = client.chat.export_channels(
    channels=[
        ChannelExport(
            type="livestream",
            id="white-room",
        ),
    ],
    include_truncated_messages=True,
    include_soft_deleted_channels=True,
)

task_id = response.data.task_id

# Export multiple channels
response = client.chat.export_channels(
    channels=[
        ChannelExport(type="livestream", id="white-room"),
        ChannelExport(type="livestream", id="white-room2"),
    ],
)

task_id = response.data.task_id
```

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

<Admonition type="info">

A single request can export up to 25 channels.

</Admonition>

### Export Format (v2)

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

```python label="Python"
from getstream.models import ChannelExport

response = client.chat.export_channels(
    channels=[
        ChannelExport(type="livestream", id="white-room"),
    ],
    version="v2",
)
```

### Checking Export Status

[Poll the task status](https://getstream.io/docs/platform/async-operations/) using the returned task ID. When the task completes, the response includes a URL to download the JSON export file.

```python label="Python"
response = client.get_task(id=task_id)

print(response.data.status)          # Task status
print(response.data.result)          # Result object (when completed)
print(response.data.result["url"])   # Download URL
print(response.data.error)           # Error description (if failed)
```

<Admonition type="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`)

</Admonition>

## Exporting Users

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

```python label="Python"
response = client.export_users(user_ids=["user-id-1", "user-id-2"])

task_id = response.data.task_id
```

<Admonition type="info">

A single request can export up to 25 users with a maximum of 10,000 messages per user. [Contact support](https://getstream.io/contact/support/) to export users with more than 10,000 messages.

</Admonition>

### Checking Export Status

```python label="Python"
response = client.get_task(id=task_id)

if response.data.status == "completed":
    print(response.data.result["url"])
```


---

This page was last updated at 2026-09-08T17:14:06.846Z.

For the most recent version of this documentation, visit [https://getstream.io/chat/docs/python/exporting-channels/](https://getstream.io/chat/docs/python/exporting-channels/).