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
rid*
String
Defines the live chat room ID.
Headers
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.
Unauthorised access: Invalid authorisation credentials. Verify your authorisation key, update, and try again with correct credentials.
File type is not supported: Invalid media type. Use only the supported media types such as TXT, PNG, and JPEG.
File size is too large: Invalid file size. Use the maximum allowable limit of 5 MB for a file size.
Last updated
