> ## Documentation Index
> Fetch the complete documentation index at: https://developer.rocket.chat/llms.txt
> Use this file to discover all available pages before exploring further.

# Get List of Departments

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

## OpenAPI

````json GET /api/v1/livechat/department
{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0.0",
    "title": "Omnichannel"
  },
  "servers": [
    {
      "url": "https://apiexplorer.support.rocket.chat"
    }
  ],
  "tags": [
    {
      "name": "Omnichannel Users"
    },
    {
      "name": "Omnichannel Agents"
    },
    {
      "name": "Omnichannel Monitors"
    },
    {
      "name": "Omnichannel Visitors"
    },
    {
      "name": "Omnichannel Contacts"
    },
    {
      "name": "Omnichannel Rooms"
    },
    {
      "name": "Omnichannel Departments"
    },
    {
      "name": "Omnichannel Custom Fields"
    },
    {
      "name": "Omnichannel Business Hours"
    },
    {
      "name": "Omnichannel Priorities"
    },
    {
      "name": "Omnichannel Tags"
    },
    {
      "name": "Omnichannel Units"
    },
    {
      "name": "SLA Policies"
    },
    {
      "name": "Canned Responses"
    },
    {
      "name": "Omnichannel Transcript"
    },
    {
      "name": "Omnichannel Statistics"
    },
    {
      "name": "Omnichannel Agent Stats"
    },
    {
      "name": "Omnichannel Dashboards"
    },
    {
      "name": "Reports"
    },
    {
      "name": "Omnichannel Inquiries"
    },
    {
      "name": "Omnichannel Webhooks"
    },
    {
      "name": "Livechat"
    },
    {
      "name": "Livechat Appearance"
    },
    {
      "name": "Livechat Triggers"
    },
    {
      "name": "Livechat Messages"
    },
    {
      "name": "Livechat Page Visited"
    }
  ],
  "paths": {
    "/api/v1/livechat/department": {
      "get": {
        "summary": "Get List of Departments",
        "description": "Get a list of the departments.\nAt least one of the following permissions is required:\n* `view-livechat-departments`\n* `view-l-room`\n\n### Changelog\n| Version      | Description |\n| ---------------- | ------------|\n|2.2.0             | Added support to pagination    |\n|0.42.0            | Added       |",
        "parameters": [
          {
            "$ref": "#/components/parameters/AuthToken"
          },
          {
            "$ref": "#/components/parameters/UserId"
          },
          {
            "name": "text",
            "in": "query",
            "description": "Filter the result with any text.",
            "schema": {
              "type": "string"
            },
            "example": "fin"
          },
          {
            "name": "enabled",
            "in": "query",
            "description": "Filter the result to only show enabled departments. The value can be boolean true or false.",
            "schema": {
              "type": "boolean"
            },
            "example": "true"
          },
          {
            "name": "showArchived",
            "in": "query",
            "description": "You can include the archived departments in the result. The value can be boolean true or false.",
            "schema": {
              "type": "boolean"
            },
            "example": "true"
          },
          {
            "name": "onlyMyDepartments",
            "in": "query",
            "description": "This parameter is for users with managers or admin roles. It only displays the departments that you are an agent of.",
            "schema": {
              "type": "boolean"
            },
            "example": "true"
          },
          {
            "name": "excludeDepartmentId",
            "in": "query",
            "description": "The department ID that you want to exclude from the result.",
            "schema": {
              "type": "string"
            },
            "example": "64181a0728384134ed600dcc"
          },
          {
            "$ref": "#/components/parameters/offset"
          },
          {
            "$ref": "#/components/parameters/count"
          },
          {
            "$ref": "#/components/parameters/sort"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "departments": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "_id": {
                            "type": "string"
                          },
                          "enabled": {
                            "type": "boolean"
                          },
                          "name": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "showOnRegistration": {
                            "type": "boolean"
                          },
                          "showOnOfflineForm": {
                            "type": "boolean"
                          },
                          "requestTagBeforeClosingChat": {
                            "type": "boolean"
                          },
                          "email": {
                            "type": "string"
                          },
                          "chatClosingTags": {
                            "type": "array",
                            "items": {
                              "type": "object"
                            }
                          },
                          "offlineMessageChannelName": {
                            "type": "string"
                          },
                          "abandonedRoomsCloseCustomMessage": {
                            "type": "string"
                          },
                          "waitingQueueMessage": {
                            "type": "string"
                          },
                          "departmentsAllowedToForward": {
                            "type": "array",
                            "items": {
                              "type": "object"
                            }
                          },
                          "fallbackForwardDepartment": {
                            "type": "string"
                          },
                          "_updatedAt": {
                            "type": "string"
                          },
                          "numAgents": {
                            "type": "integer"
                          },
                          "type": {
                            "type": "string"
                          },
                          "businessHourId": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "count": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    },
                    "total": {
                      "type": "integer"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  }
                },
                "examples": {
                  "Success Example": {
                    "value": {
                      "departments": [
                        {
                          "_id": "64181a0728384134ed600dcc",
                          "enabled": "true",
                          "name": "Support",
                          "description": "",
                          "showOnRegistration": "false",
                          "showOnOfflineForm": "false",
                          "requestTagBeforeClosingChat": "false",
                          "email": "kim.jane@rocketchat.com",
                          "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": "test@gmail.com",
                          "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"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/authorizationError"
          },
          "403": {
            "$ref": "#/components/responses/permissionError"
          }
        },
        "tags": [
          "Omnichannel Departments"
        ],
        "operationId": "get-api-v1-livechat-department"
      }
    }
  },
  "components": {
    "parameters": {
      "AuthToken": {
        "name": "X-Auth-Token",
        "in": "header",
        "description": "The `authToken` of the authenticated user.",
        "required": "true",
        "schema": {
          "type": "string"
        },
        "example": "RScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f"
      },
      "UserId": {
        "name": "X-User-Id",
        "in": "header",
        "description": "The `userId` of the authenticated user.",
        "required": "true",
        "schema": {
          "type": "string"
        },
        "example": "rbAXPnMktTFbNpwtJ"
      },
      "offset": {
        "name": "offset",
        "in": "query",
        "required": "false",
        "schema": {
          "type": "integer"
        },
        "example": "50",
        "description": "Number of items to \"skip\" in the query, i.e. requests return count items, skipping the first offset items. Refer to the [official documentation](https://developer.rocket.chat/apidocs/query-parameters#pagination) to learn more."
      },
      "count": {
        "name": "count",
        "in": "query",
        "required": "false",
        "schema": {
          "type": "integer"
        },
        "example": "25",
        "description": "The number of items to return. Refer to the [official documentation](https://developer.rocket.chat/apidocs/query-parameters#pagination) to learn more."
      },
      "sort": {
        "name": "sort",
        "in": "query",
        "required": "false",
        "schema": {
          "format": "object"
        },
        "description": "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](https://developer.rocket.chat/apidocs/query-parameters#pagination) to learn more."
      }
    },
    "responses": {
      "authorizationError": {
        "description": "Unauthorized",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            },
            "examples": {
              "Authorization Error": {
                "value": {
                  "status": "error",
                  "message": "You must be logged in to do this."
                }
              }
            }
          }
        }
      },
      "permissionError": {
        "description": "Forbidden",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean"
                },
                "error": {
                  "type": "string"
                }
              }
            },
            "examples": {
              "Permission Error": {
                "value": {
                  "success": "false",
                  "error": "User does not have the permissions required for this action [error-unauthorized]"
                }
              },
              "Unauthorized": {
                "value": {
                  "success": "false",
                  "error": "unauthorized"
                }
              }
            }
          }
        }
      }
    }
  }
}
````

