---
title: "Export Room"
slug: "export-room"
updated: 2026-09-03T14:50:33Z
published: 2026-09-03T14:50:33Z
canonical: "developer.rocket.chat/export-room"
stale: true
---
> ## Documentation Index
> Fetch the complete documentation index at: https://developer.rocket.chat/llms.txt
> Use this file to discover all available pages before exploring further.
# Export Room
Post/api/v1/rooms.export
Export room messages to a file or email. When exporting to a file, the ZIP file is stored in the `/tmp` directory on the Rocket.Chat server, and its details are recorded in the `rocketchat_user_data_files` collection in MongoDB.
Permission required: `mail-messages`
### Changelog
| Version | Description |
| --- | --- |
| 3.8.0 | Added |
Header parametersX-Auth-TokenstringRequired
The `authToken` of the authenticated user.
ExampleRScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f
X-User-IdstringRequired
The `userId` of the authenticated user.
ExamplerbAXPnMktTFbNpwtJ
Body parametersExample
```json
{
"rid": "iu7jtPAhvEeAS5tNq",
"type": "file",
"dateFrom": "2000-01-01",
"dateTo": "2021-11-25",
"format": "html",
"toUsers": [
"test.user"
],
"toEmails": [
"test@test.com"
],
"messages": [
"yd6NBgNoiWATgDoFt",
"BoCjicj9DdYoMHHeo",
"tajMB3aX3sawFWe8W"
],
"subject": "Test Subject "
}
```
object ridstring Required
The room ID.
typestring Required
How you want the room to be exported. The type of export selected determines the remaining required parameters. It can be either `email` or `file`.
dateFromstring
Start date to begin fetching. Use `dateFrom` if the type is `file`. By default, it selects the oldest possible date.
dateTostring
End date for fetching. By default it selects the current date. Use `dateTo` if the `type` is `file`.
formatstring
The file type to export as. It can either be `html` or `json`. Use `format` if the `type` is `file`.
toUsers Array of string
An array of users that should recieve the export. ecieve the export. It is required if `type` is `email`.
string
toEmails Array of string
An array of any additional emails that should recieve the export. It is required if `type` is `email`.
string
messages Array of string
An array of messageId for the messages that should be exported. It is required if `type` is `email`.
string
subjectstring
The subject of the email. It is required if `type` is `email`.
Responses200
OK
Success
```json
{
"success": true
}
```
object successboolean
400
Bad Request
Invalid Room ID
```json
{
"success": false,
"error": "[error-invalid-room]",
"errorType": "error-invalid-room"
}
```
Invalid Format
```json
{
"success": false,
"error": "[error-invalid-format]",
"errorType": "error-invalid-format"
}
```
Invalid Params
```json
{
"success": false,
"error": "[error-invalid-params]",
"errorType": "error-invalid-params"
}
```
object successboolean
errorstring
errorTypestring
401
Unauthorized
Authorization Error
```json
{
"status": "error",
"message": "You must be logged in to do this."
}
```
object statusstring
messagestring
403
Forbidden
Permission Error
```json
{
"success": false,
"error": "User does not have the permissions required for this action [error-unauthorized]"
}
```
object successboolean
errorstring