List All DMs

Prev Next
Get
/api/v1/dm.list.everyone

List all DMs in the workspace.

Permission required:view-room-administration.

Changelog

Version Description
0.49.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
Query parameters
offset
integer

Number of items to "skip" in the query, i.e. requests return count items, skipping the first offset items. Refer to the official documentation to learn more.

Example50
count
integer

The number of items to return. Refer to the official documentation to learn more.

Example50
sort

List of fields to order by, and in which direction. This is a JSON object, with properties listed in desired order, with values of 1 for ascending, or -1 for descending. For example, { "value": -1, "_id": 1 }. Refer to the official documentation to learn more.

query

This parameter allows you to use MongoDB query operators to search for specific data. For example, to query users with a name that contains the letter "g": query={ "name": { "$regex": "g" }}. Refer to the official documentation to learn more.

fields
string

This parameter accepts a JSON object with properties that have a value of 1 or 0 to include or exclude them in the response. For example, to only retrieve the usernames of users: fields={ "username": 1 }. Refer to the official documentation to learn more.

Responses
200

OK

Example 1
{
  "ims": [
    {
      "_id": "rYhzFRd2QZjNwAAXXrocket.cat",
      "t": "d",
      "usernames": [
        "rocket.cat",
        "rodriq"
      ],
      "usersCount": 2,
      "msgs": 20,
      "ts": "2023-01-25T02:00:18.095Z",
      "uids": [
        "rYhzFRd2QZjNwAAXX",
        "rocket.cat"
      ],
      "default": false,
      "ro": false,
      "sysMes": true,
      "_updatedAt": "2023-06-22T02:00:10.474Z",
      "_USERNAMES": [
        "rocket.cat",
        "rodriq"
      ],
      "lastMessage": {
        "rid": "rYhzFRd2QZjNwAAXXrocket.cat",
        "msg": "*Update your Rocket.Chat*\nNew version available (6.2.8)\nhttps://github.com/RocketChat/Rocket.Chat/releases/tag/6.2.8",
        "ts": "2023-06-22T02:00:10.367Z",
        "u": {
          "_id": "rocket.cat",
          "username": "rocket.cat",
          "name": "Rocket.Cat"
        },
        "_id": "T2KoWNeAgJM4zvTvt",
        "_updatedAt": "2023-06-22T02:00:10.453Z",
        "urls": [
          {
            "url": "https://github.com/RocketChat/Rocket.Chat/releases/tag/6.2.8",
            "meta": {}
          }
        ],
        "mentions": [],
        "channels": [],
        "md": [
          {
            "type": "PARAGRAPH",
            "value": [
              {
                "type": "BOLD",
                "value": [
                  {
                    "type": "PLAIN_TEXT",
                    "value": "Update your Rocket.Chat"
                  }
                ]
              }
            ]
          },
          {
            "type": "PARAGRAPH",
            "value": [
              {
                "type": "PLAIN_TEXT",
                "value": "New version available (6.2.8)"
              }
            ]
          },
          {
            "type": "PARAGRAPH",
            "value": [
              {
                "type": "LINK",
                "value": {
                  "src": {
                    "type": "PLAIN_TEXT",
                    "value": "https://github.com/RocketChat/Rocket.Chat/releases/tag/6.2.8"
                  },
                  "label": [
                    {
                      "type": "PLAIN_TEXT",
                      "value": "https://github.com/RocketChat/Rocket.Chat/releases/tag/6.2.8"
                    }
                  ]
                }
              }
            ]
          }
        ]
      },
      "lm": "2023-06-22T02:00:10.367Z"
    },
    {
      "_id": "6xia7f5JEYM4Fjxzt",
      "t": "d",
      "usernames": [
        "rodriq"
      ],
      "usersCount": 2,
      "msgs": 0,
      "ts": "2023-01-30T11:43:22.047Z",
      "uids": [
        "rYhzFRd2QZjNwAAXX"
      ],
      "default": false,
      "ro": false,
      "sysMes": true,
      "_updatedAt": "2023-01-31T14:40:37.483Z",
      "_USERNAMES": [
        "rodriq"
      ],
      "lm": "2023-01-30T11:43:30.046Z"
    }
  ],
  "offset": 0,
  "count": 2,
  "total": 2,
  "success": true
}
Expand All
object
ims
Array of object
object
_id
string
t
string
usernames
Array of string
string
usersCount
integer
msgs
integer
ts
string
uids
Array of string
string
default
boolean
ro
boolean
sysMes
boolean
_updatedAt
string
_USERNAMES
Array of string
string
lastMessage
object
rid
string
msg
string
ts
string
u
object
_id
string
username
string
name
string
_id
string
_updatedAt
string
urls
Array of object
object
url
string
meta
object
mentions
Array of object
object
channels
Array of object
object
md
Array of object
object
type
string
value
Array of object
object
type
string
value
Array of object
object
type
string
value
string
src
object
type
string
value
string
label
Array of object
object
type
string
value
string
lm
string
offset
integer
count
integer
total
integer
success
boolean
401

Unauthorized

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