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.

Upload Media Files to a Room

Prev Next
Post
/api/v1/rooms.media/{rid}

Only users who have access to send messages in a room can upload files there.

You can't upload any file that exceeds the configured Maximum File Upload Size.

To upload media files to a room, follow these steps:

  1. Call this endpoint first. This endpoint uploads the file to the database and returns a file object with the file ID and URL data. Save the file ID, you will need this to send the file in the next step.
  2. To send the file to a room, use the Send Uploaded File to a Room endpoint.

The upload is temporary and expires 24 hours after this call. If you don't confirm it within that window, it is discarded and never appears in the room.

Header parameters
X-Auth-Token
stringRequired

The authToken of the authenticated user.

ExampleRScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f
X-User-Id
stringRequired

The userId of the authenticated user.

ExamplerbAXPnMktTFbNpwtJ
Path parameters
rid
stringRequired

The ID of the room where the file will be uploaded.

Example674eca3e43725ce31dd9a2e8
Body parameters
object
file
string (binary) Required

The file to upload.

content
string

A JSON-encoded object containing additional metadata for the uploaded file.

Responses
200

OK

Example
{
  "file": {
    "_id": "67109d6c25682c7469486008",
    "url": "/file-upload/67109d6c25682c7469486008/Screenshot%202024-10-15%20at%2010.17.39.png"
  },
  "success": true
}
Expand All
object
file
object
_id
string
url
string
success
boolean