Export Room

Export room to a file or email.

This requires the user to have the mail-messages permission.

HTTP MethodURLRequires Auth

POST

/api/v1/rooms.export

Body Parameters

KeyExample ValueDescription

rid*

JZ8Y2dLfYhsg323Rf

The room ID.

type*

email or file

How you want the room to be exported.

dateFrom

2020-01-13

Start date to begin fetching.

dateTo

2021-12-13

End date for fetching.

format*

html or json

The file type to export as.

Example Call

curl -L -X POST 'http://localhost:3000/api/v1/rooms.export' \
-H 'X-User-Id: d26x6zSkaPSe5gCyy' \
-H 'X-Auth-Token: Zu-Z6eKzIIz7MCCRGeHi29bYkXZCJ4SxFC0JAasqm92' \
-H 'Content-Type: application/json' \
--data-raw '{
    "rid": "iu7jtPAhvEeAS5tNq",
    "type": "file",
    "dateFrom": "2000-01-01",
    "dateTo": "2021-11-25",
    "format": "html"
}'

Example Response

Success

{
    "success": true
}

Error

Any of the following errors can occur:

  • Authorization: Requires an authentication token for the request to be made.

  • Invalid Params: Occurs when one or more needed parameters are missing.

  • Invalid Room: Occurs when the given rid is invalid.

  • Not Allowed: Occurs when the user lacks the mail-messages permission and doesn't have access to the room.

  • Invalid Format: Occurs when the export format is not specified

{
    "success": false,
    "error": "unauthorized"
}
VersionDescription

3.8.0

Added

Last updated

Rocket.Chat versions receive support for six months after release.