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

# Search Omnichannel Contacts

> Retrieve a list of omnichannel contacts based on search criteria like name, email or phone number.
Permission required: `view-livechat-contact`.

**Note**: Ensure to URL-encode special characters such as `@`, `+`, `/`, and `*` in query parameters to prevent issues with the endpoint. For example, encode email addresses as `mail%40example.com` instead of `mail@example.com`.

## OpenAPI

````json GET /api/v1/omnichannel/contacts.search
{
  "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/omnichannel/contacts.search": {
      "get": {
        "summary": "Search Omnichannel Contacts",
        "tags": [
          "Omnichannel Contacts"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "contacts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "_id": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "emails": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "address": {
                                  "type": "string"
                                }
                              }
                            }
                          },
                          "phones": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {}
                            }
                          },
                          "channels": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string"
                                },
                                "visitor": {
                                  "type": "object",
                                  "properties": {
                                    "visitorId": {
                                      "type": "string"
                                    },
                                    "source": {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string"
                                        }
                                      }
                                    }
                                  }
                                },
                                "blocked": {
                                  "type": "boolean"
                                },
                                "verified": {
                                  "type": "boolean"
                                },
                                "details": {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string"
                                    },
                                    "destination": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "lastChat": {
                                  "type": "object",
                                  "properties": {
                                    "_id": {
                                      "type": "string"
                                    },
                                    "ts": {
                                      "type": "string"
                                    }
                                  }
                                }
                              }
                            }
                          },
                          "customFields": {
                            "type": "object",
                            "properties": {
                              "social-number": {
                                "type": "string"
                              }
                            }
                          },
                          "unknown": {
                            "type": "boolean"
                          },
                          "_updatedAt": {
                            "type": "string"
                          },
                          "conflictingFields": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {}
                            }
                          },
                          "lastChat": {
                            "type": "object",
                            "properties": {
                              "_id": {
                                "type": "string"
                              },
                              "ts": {
                                "type": "string"
                              }
                            }
                          },
                          "contactManager": {
                            "type": "object",
                            "properties": {
                              "_id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "username": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    },
                    "count": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    },
                    "total": {
                      "type": "integer"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  }
                },
                "examples": {
                  "Example 1": {
                    "value": {
                      "contacts": [
                        {
                          "_id": "673be1711e2e6feb77939a7b",
                          "createdAt": "2024-11-19T00:53:05.468Z",
                          "name": "Boris Doe",
                          "emails": [
                            {
                              "address": "boris@doe.com"
                            }
                          ],
                          "phones": [],
                          "channels": [
                            {
                              "name": "widget",
                              "visitor": {
                                "visitorId": "673be2101e2e6feb77939a7f",
                                "source": {
                                  "type": "widget"
                                }
                              },
                              "blocked": "false",
                              "verified": "false",
                              "details": {
                                "type": "widget",
                                "destination": "example.com"
                              },
                              "lastChat": {
                                "_id": "NMee5zFPv62N7RAhh",
                                "ts": "2024-11-19T00:55:46.723Z"
                              }
                            }
                          ],
                          "customFields": {
                            "social-number": "45600-00"
                          },
                          "unknown": "false",
                          "_updatedAt": "2024-11-19T00:56:43.14Z",
                          "conflictingFields": [],
                          "lastChat": {
                            "_id": "NMee5zFPv62N7RAhh",
                            "ts": "2024-11-19T00:55:46.723Z"
                          },
                          "contactManager": {
                            "_id": "mAwAgmNndK7SHnQ89",
                            "name": "Jane",
                            "username": "Jane"
                          }
                        }
                      ],
                      "count": "1",
                      "offset": "0",
                      "total": "1",
                      "success": "true"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "error": {
                      "type": "string"
                    },
                    "errorType": {
                      "type": "string"
                    }
                  }
                },
                "examples": {
                  "Example 1": {
                    "value": {
                      "success": "false",
                      "error": "must be number [invalid-params]",
                      "errorType": "invalid-params"
                    }
                  },
                  "Example 2": {
                    "value": {
                      "success": "false",
                      "error": "must be boolean [invalid-params]",
                      "errorType": "invalid-params"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/authorizationError"
          },
          "403": {
            "$ref": "#/components/responses/permissionError"
          }
        },
        "operationId": "get-api-v1-omnichannel-contacts.search",
        "description": "Retrieve a list of omnichannel contacts based on search criteria like name, email or phone number.\nPermission required: `view-livechat-contact`.\n\n**Note**: Ensure to URL-encode special characters such as `@`, `+`, `/`, and `*` in query parameters to prevent issues with the endpoint. For example, encode email addresses as `mail%40example.com` instead of `mail@example.com`.",
        "parameters": [
          {
            "$ref": "#/components/parameters/AuthToken"
          },
          {
            "$ref": "#/components/parameters/UserId"
          },
          {
            "$ref": "#/components/parameters/offset"
          },
          {
            "$ref": "#/components/parameters/count"
          },
          {
            "$ref": "#/components/parameters/sort"
          },
          {
            "schema": {
              "type": "string",
              "example": "John"
            },
            "in": "query",
            "name": "searchText",
            "description": "Text to search for in contact details."
          },
          {
            "schema": {
              "type": "boolean",
              "example": "false"
            },
            "in": "query",
            "name": "unknown",
            "description": "Filter by contact's unknown status."
          }
        ]
      }
    }
  },
  "components": {
    "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"
                }
              }
            }
          }
        }
      }
    },
    "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."
      }
    }
  }
}
````

