Get List of Departments

Prev Next
Get
/api/v1/livechat/department

Get a list of the departments. At least one of the following permissions is required:

  • view-livechat-departments
  • view-l-room

Changelog

Version Description
2.2.0 Added support to pagination
0.42.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
text
string

Filter the result with any text.

Examplefin
enabled
boolean

Filter the result to only show enabled departments. The value can be boolean true or false.

ExampleTrue
showArchived
boolean

You can include the archived departments in the result. The value can be boolean true or false.

ExampleTrue
onlyMyDepartments
boolean

This parameter is for users with managers or admin roles. It only displays the departments that you are an agent of.

ExampleTrue
excludeDepartmentId
string

The department ID that you want to exclude from the result.

Example64181a0728384134ed600dcc
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.

Responses
200

OK

Success Example
{
  "departments": [
    {
      "_id": "64181a0728384134ed600dcc",
      "enabled": true,
      "name": "Support",
      "description": "",
      "showOnRegistration": false,
      "showOnOfflineForm": false,
      "requestTagBeforeClosingChat": false,
      "email": "[email protected]",
      "chatClosingTags": [],
      "offlineMessageChannelName": "Livestream",
      "abandonedRoomsCloseCustomMessage": "",
      "waitingQueueMessage": "",
      "departmentsAllowedToForward": [],
      "fallbackForwardDepartment": "",
      "_updatedAt": "2023-10-13T13:03:58.406Z",
      "numAgents": 4,
      "type": "d"
    },
    {
      "_id": "649230d479f5c6e276cf4a12",
      "enabled": false,
      "name": "Finance",
      "description": "",
      "showOnRegistration": false,
      "showOnOfflineForm": false,
      "requestTagBeforeClosingChat": false,
      "email": "[email protected]",
      "chatClosingTags": [],
      "offlineMessageChannelName": "",
      "abandonedRoomsCloseCustomMessage": "",
      "waitingQueueMessage": "",
      "departmentsAllowedToForward": [],
      "fallbackForwardDepartment": "",
      "type": "d",
      "_updatedAt": "2023-10-13T13:03:58.426Z",
      "numAgents": 3,
      "businessHourId": "650dc9cfa2f73c7460e18bea"
    }
  ],
  "count": 2,
  "offset": 0,
  "total": 2,
  "success": true
}
Expand All
object
departments
Array of object
object
_id
string
enabled
boolean
name
string
description
string
showOnRegistration
boolean
showOnOfflineForm
boolean
requestTagBeforeClosingChat
boolean
email
string
chatClosingTags
Array of object
object
offlineMessageChannelName
string
abandonedRoomsCloseCustomMessage
string
waitingQueueMessage
string
departmentsAllowedToForward
Array of object
object
fallbackForwardDepartment
string
_updatedAt
string
numAgents
integer
type
string
businessHourId
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