Upload File to a Room

Post
Deprecated
/api/v1/rooms.upload/{rid}

This endpoint has been deprecated and is scheduled for removal in the 8.0.0 release. Use the rooms.media endpoint instead.

Post a message with the attached file to a dedicated room.

Changelog

Version Description
6.8.0 Allow custom fields in messages
1.0.0 Return Message object on file upload
0.62.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
Path parameters
rid
stringRequired

The room ID to which you want to upload the file.

ExampleByehQjC44FwMeiLbX
Body parameters

For some file types, when uploading via curl, you may need to set the mime type.

With some file types, curl will upload the file as application/octet-stream. You can pass a custom mime type like this: -F \"[email protected];type=audio/wav\" to specify the type.

Expand All
object
file
string (binary) Required

The file to upload

msg
string

A message text to be sent with the file.

description
string

A description of the file.

tmid
string

The thread message ID (if you want to upload a file to a thread).

customFields
object

You can add custom fields for messages. For example, set priorities for messages.

You must enable this option and define the validation in the workspace settings. See the Message for further information.

Example{ "priority": "high" }
Responses
200

OK

Example
{
  "message": {
    "_id": "XhqGxkXYtcYba2F9K",
    "rid": "GENERAL",
    "ts": "2022-06-29T07:34:33.736Z",
    "msg": "This is a message with a file",
    "file": {
      "_id": "pw6oyrjBStWwMdeMv",
      "name": "example.txt",
      "type": "text/plain"
    },
    "files": [
      {
        "_id": "pw6oyrjBStWwMdeMv",
        "name": "example.txt",
        "type": "text/plain"
      }
    ],
    "attachments": [
      {
        "ts": "1970-01-01T00:00:00.000Z",
        "title": "example.txt",
        "title_link": "/file-upload/pw6oyrjBStWwMdeMv/example.txt",
        "title_link_download": true,
        "type": "file",
        "description": "Simple text file"
      }
    ],
    "u": {
      "_id": "g8aroJivN5R32TxCm",
      "username": "rodriq",
      "name": "Rodriq"
    },
    "_updatedAt": "2022-06-29T07:34:33.811Z",
    "urls": [],
    "md": [
      {
        "type": "PARAGRAPH",
        "value": [
          {
            "type": "PLAIN_TEXT",
            "value": "This is a message with a file"
          }
        ]
      }
    ]
  },
  "success": true
}
Expand All
object
message
object
_id
string
rid
string
ts
string
msg
string
file
object
_id
string
name
string
type
string
files
Array of object
object
_id
string
name
string
type
string
attachments
Array of object
object
ts
string
title
string
title_link
string
title_link_download
boolean
type
string
description
string
u
object
_id
string
username
string
name
string
_updatedAt
string
urls
Array of object
object
md
Array of object
object
type
string
value
Array of object
object
type
string
value
string
success
boolean
400

Bad Request

Unknown key
{
  "success": false,
  "error": "Match error: Unknown key in field dasd"
}
Invalid field
{
  "success": false,
  "error": "[invalid-field]",
  "errorType": "invalid-field"
}
object
success
boolean
error
string
401

Unauthorized

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