Upload File to a Room
    • Dark
      Light
    • PDF

    Upload File to a Room

    • Dark
      Light
    • PDF

    Article summary

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

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

    Changelog

    VersionDescription
    1.0.0Return Message object on file upload
    0.62.0Added
    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 settings 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

    Example 1
    {
      "success": false,
      "error": "Match error: Unknown key in field dasd"
    }
    Example 2
    {
      "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

    Was this article helpful?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.