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 parameters
X-Auth-Token
stringRequired

The authToken of the authenticated user.

ExampleRScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f
X-User-Id
stringRequired

The userId of the authenticated user.

ExamplerbAXPnMktTFbNpwtJ
Body parameters
Example
{
  "rid": "iu7jtPAhvEeAS5tNq",
  "type": "file",
  "dateFrom": "2000-01-01",
  "dateTo": "2021-11-25",
  "format": "html",
  "toUsers": [
    "test.user"
  ],
  "toEmails": [
    "[email protected]"
  ],
  "messages": [
    "yd6NBgNoiWATgDoFt",
    "BoCjicj9DdYoMHHeo",
    "tajMB3aX3sawFWe8W"
  ],
  "subject": "Test Subject "
}
object
rid
string Required

The room ID.

type
string 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.

dateFrom
string

Start date to begin fetching. Use dateFrom if the type is file. By default, it selects the oldest possible date.

dateTo
string

End date for fetching. By default it selects the current date. Use dateTo if the type is file.

format
string

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
subject
string

The subject of the email. It is required if type is email.

Responses
200

OK

Success
{
  "success": true
}
object
success
boolean
400

Bad Request

Invalid Room ID
{
  "success": false,
  "error": "[error-invalid-room]",
  "errorType": "error-invalid-room"
}
Invalid Format
{
  "success": false,
  "error": "[error-invalid-format]",
  "errorType": "error-invalid-format"
}
Invalid Params
{
  "success": false,
  "error": "[error-invalid-params]",
  "errorType": "error-invalid-params"
}
object
success
boolean
error
string
errorType
string
401

Unauthorized

Authorization Error
{
  "status": "error",
  "message": "You must be logged in to do this."
}
object
status
string
message
string
403

Forbidden

Permission Error
{
  "success": false,
  "error": "User does not have the permissions required for this action [error-unauthorized]"
}
object
success
boolean
error
string