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

# Autocomplete Department

> Autocomplete the department name.
At least one of the following permissions is required:
  * `view-livechat-departments`
  * `view-l-room`

## OpenAPI

````json GET /api/v1/livechat/department.autocomplete
{
  "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.autocomplete": {
      "get": {
        "summary": "Autocomplete Department",
        "description": "Autocomplete the department name.\nAt least one of the following permissions is required:\n  * `view-livechat-departments`\n  * `view-l-room`",
        "operationId": "get-api-v1-livechat-department.autocomplete",
        "parameters": [
          {
            "$ref": "#/components/parameters/AuthToken"
          },
          {
            "$ref": "#/components/parameters/UserId"
          },
          {
            "name": "selector",
            "in": "query",
            "description": "Enter the exceptions or the conditions that you want to search for.",
            "required": "true",
            "schema": {
              "type": "string"
            },
            "example": "{\"exceptions\" : [\"${dep1._id}\"], \"conditions\": {\"enabled\": true}, \"term\":\"test\"}"
          },
          {
            "name": "onlyMyDepartments",
            "in": "query",
            "description": "Only displays the departments that you are assigned to. The value can be boolean `true` or `false`",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "showArchived",
            "in": "query",
            "description": "The result includes archived departments. The value can be Boolean `true` or `false`.",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "examples": {
                  "Example 1": {
                    "value": {
                      "departments": [
                        {
                          "_id": "qajzu7WaBRoQBpq6Z",
                          "enabled": "true",
                          "name": "Brazil",
                          "description": "",
                          "numAgents": "3",
                          "showOnRegistration": "false",
                          "showOnOfflineForm": "true",
                          "email": "brazil@rocketchat.com",
                          "_updatedAt": "2021-06-23T06:02:02.931Z",
                          "chatClosingTags": [],
                          "maxNumberSimultaneousChat": "",
                          "requestTagBeforeClosingChat": "false",
                          "type": "d",
                          "waitingQueueMessage": "",
                          "abandonedRoomsCloseCustomMessage": "",
                          "departmentsAllowedToForward": "",
                          "offlineMessageChannelName": "",
                          "visitorInactivityTimeoutInSeconds": "",
                          "ancestors": []
                        },
                        {
                          "_id": "NhnC9dBwFonZqSQ5m",
                          "enabled": "true",
                          "name": "CSM and Support",
                          "description": "",
                          "showOnRegistration": "true",
                          "showOnOfflineForm": "false",
                          "requestTagBeforeClosingChat": "false",
                          "email": "br@rocketchat.com",
                          "chatClosingTags": [],
                          "offlineMessageChannelName": "",
                          "abandonedRoomsCloseCustomMessage": "",
                          "waitingQueueMessage": "",
                          "departmentsAllowedToForward": [
                            "CAJioQNAvLnYWTy8i",
                            "Z2KWYBJQFR7AzfmQL"
                          ],
                          "_updatedAt": "2021-07-12T18:05:53.257Z",
                          "numAgents": "4"
                        }
                      ],
                      "count": "2",
                      "offset": "0",
                      "total": "2",
                      "success": "true"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                },
                "examples": {
                  "Example 1": {
                    "value": {
                      "success": "false",
                      "error": "The 'selector' param is required"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/authorizationError"
          }
        },
        "tags": [
          "Omnichannel Departments"
        ]
      }
    }
  },
  "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"
      }
    },
    "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."
                }
              }
            }
          }
        }
      }
    }
  }
}
````

