---
title: "Export Room"
slug: "export-room"
updated: 2026-06-01T06:32:04Z
published: 2026-06-01T06:32:04Z
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 parameters<select class='api-response-data' aria-label='Media type'><option value='e7918a1d-12b0-441f-b077-9132cc2e8285'>application/json</option>
</select><select class='select-example' aria-label='Media type'><option value='076db21f-8a0a-417f-9798-f284dac43a29'>Example</option>
</select>Example

```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

<select class='api-response-data' aria-label='Media type'><option value='e2414163-2bdb-4890-ad31-9b180fb789bc'>application/json</option>
</select><select class='select-example' aria-label='Media type'><option value='af28a49e-9385-40d7-b4e2-6bb3cb627a3c'>Success</option>
</select>Success

```json
{
  "success": true
}
```

object  successboolean    

400

Bad Request

<select class='api-response-data' aria-label='Media type'><option value='213ba1ae-7193-49c4-9887-9fb08364dce2'>application/json</option>
</select><select class='select-example' aria-label='Media type'><option value='c854a314-ae2c-4d17-9a8f-3cdd4a708be6'>Invalid Room ID</option>
<option value='b8c896b3-5980-463e-9bfd-c854f7f7be54'>Invalid Format</option>
<option value='4891a622-41b1-4aa8-949d-9cc3f001fff6'>Invalid Params</option>
</select>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

<select class='api-response-data' aria-label='Media type'><option value='a250c93d-4495-4943-8e83-681bab16358e'>application/json</option>
</select><select class='select-example' aria-label='Media type'><option value='de1be792-65d9-4589-b34b-55a1a6095383'>Authorization Error</option>
</select>Authorization Error

```json
{
  "status": "error",
  "message": "You must be logged in to do this."
}
```

object  statusstring    
messagestring    

403

Forbidden

<select class='api-response-data' aria-label='Media type'><option value='1aa8b37c-eb3b-4db7-b397-8ba1a996e9df'>application/json</option>
</select><select class='select-example' aria-label='Media type'><option value='1208f711-2a69-44b1-bbae-7be0a61594db'>Permission Error</option>
</select>Permission Error

```json
{
  "success": false,
  "error": "User does not have the permissions required for this action [error-unauthorized]"
}
```

object  successboolean    
errorstring
