Get List of Livechat Rooms

Get
/api/v1/livechat/rooms

Retrieves a list of Livechat rooms. You can use the available query parameters to filter the response. At least one of the following permissions is required:

  • view-livechat-rooms
  • view-l-room

Changelog

Version Description
7.0.0 Remove support of filtering by agent's username
2.4.0 Added support to the parameter roomName
2.0.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
agents
array of string

A list of agent IDs.

Example['b32h3b2hhwb25d']
departmentId
string

The department ID. You can also enter multiple IDs as an array of string values.

ExampleAkzpHAvZpdnuchw2a
open
boolean

If it should filter by open/closed rooms.

ExampleTrue
createdAt
string

An object representing when the room was created (can also be filtered only with start or end).

Example{"start": "2018-01-26T00:11:22.345Z", "end": "2018-01-26T00:11:22.345Z"}
closedAt
string

An object representing when the room was closed (can also be filtered only with start or end).

Example{"start": "2018-01-26T00:11:22.345Z", "end": "2018-01-26T00:11:22.345Z"}
tags
string

A list of tags.

Example['rocket', 'chat']
customFields
string

An object with custom fields to be filtered (previously created and populated at custom fields endpoints)

Example{"docId": "aobEdbYhXfu5hkeqG"}
roomName
string

The room's name.

Exampleroom-name
onhold
boolean

Whether you want to include livechat rooms that are on hold or not.

queued
string

Whether you want to include queued rooms or not.

units
array of string

Enter the unit IDs you want to include as an array of string values.

Example['b32h3b2hhwb25d', 'b32h3b2aaaa']
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.

Example25
sort
(object)

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

fields

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

Success Example
{
  "rooms": [
    {
      "_id": "9dQMveZhqxiDgCM3B",
      "msgs": 1,
      "usersCount": 1,
      "lm": "2019-08-09T20:18:02.350Z",
      "fname": "Marcos Defendi",
      "t": "l",
      "ts": "2019-08-09T20:18:02.108Z",
      "v": {
        "_id": "xh45w4y7oPW5SiMJu",
        "username": "guest-4",
        "token": "xn5hdkyptei11m07f3me",
        "status": "online"
      },
      "servedBy": {
        "_id": "3kyWm8PsmwhC7xgwg",
        "username": "marcos",
        "ts": "2019-08-09T20:18:02.109Z"
      },
      "cl": false,
      "open": true,
      "waitingResponse": true,
      "departmentId": "xnmXQmytuvxp2TuSC",
      "_updatedAt": "2019-08-09T20:19:34.856Z",
      "lastMessage": {
        "_id": "TBEz7zSCBaKsfyrzc",
        "rid": "9dQMveZhqxiDgCM3B",
        "msg": "Hello",
        "token": "xn5hdkyptei11m07f3me",
        "alias": "Marcos Defendi",
        "ts": "2019-08-09T20:18:02.350Z",
        "u": {
          "_id": "xh45w4y7oPW5SiMJu",
          "username": "guest-4",
          "name": "Marcos Defendi"
        },
        "_updatedAt": "2019-08-09T20:18:02.383Z",
        "mentions": [],
        "channels": [],
        "newRoom": false,
        "showConnecting": false
      },
      "metrics": {
        "v": {
          "lq": "2019-08-09T20:18:02.350Z"
        }
      },
      "livechatData": {
        "docId": "0310584343112"
      },
      "tags": [
        "rocket",
        "chat"
      ],
      "name": "Marcos Defendi"
    }
  ],
  "count": 1,
  "offset": 1,
  "total": 7,
  "success": true
}
Expand All
object
rooms
Array of object
object
_id
string
msgs
integer
usersCount
integer
lm
string
fname
string
t
string
ts
string
v
object
_id
string
username
string
token
string
status
string
servedBy
object
_id
string
username
string
ts
string
cl
boolean
open
boolean
waitingResponse
boolean
departmentId
string
_updatedAt
string
lastMessage
object
_id
string
rid
string
msg
string
token
string
alias
string
ts
string
u
object
_id
string
username
string
name
string
_updatedAt
string
mentions
Array of object
object
channels
Array of object
object
newRoom
boolean
showConnecting
boolean
metrics
object
v
object
lq
string
livechatData
object
docId
string
tags
Array of string
string
name
string
count
integer
offset
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
403

Forbidden

Permission Error
{
  "success": false,
  "error": "User does not have the permissions required for this action [error-unauthorized]"
}
Unauthorized
{
  "success": false,
  "error": "unauthorized"
}
object
success
boolean
error
string