Rocket Chat

This section describes the endpoint for a live chat file upload.

/api/v1/livechat/upload/:rid

Uploads a file to a live chat with a valid room ID.

POST https://<BASE URL>/api/v1/livechat/upload/:rid

Requires a path parameter and an authorised access token.

Path Parameters

NameTypeDescription

rid*

String

Defines the live chat room ID.

Headers

NameTypeDescription

X-Auth-Token*

String

Defines the access token for authentication.

{
    "success": true
}

cURL Request

Refer to the following example cURL command that uploads a file from a system to a chat room:

curl 'https://<Base_URL>/api/v1/livechat/upload/general' \
  -X POST \
  -H Authorization: Bearer '8nAQfgDpOR5I60CiyGu9L-3SXMsK6HB9CS7_1Y1Tv_X' \
  -F 'file=@/home/sugandhs/pictures/rc/path.png' \

cURL Response

Refer to the following example cURL response for the above request:

{
  "message": {
    "rid": "GENERAL",
    "visitorToken": "8nAQfgDpOR5I60CiyGu9L-3SXMsK6HB9CS7_1Y1Tv_X",
    "file": {
      "name": "Path",
      "size": 24,
      "type": "image/png"
      }
    }, 
  "success": true 
}

Error Codes

Refer to the following error codes that you may encounter while using the cURL request:

Bad request: Invalid syntax. Modify your syntax and try again.

Last updated