> ## 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 Livechat Visitor Chat History

## OpenAPI

````json GET /api/v1/livechat/visitors.chatHistory/room/{roomId}/visitor/{visitorId}
{
  "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/visitors.chatHistory/room/{roomId}/visitor/{visitorId}": {
      "parameters": [
        {
          "schema": {
            "type": "string"
          },
          "name": "roomId",
          "in": "path",
          "required": "true",
          "description": "The room ID."
        },
        {
          "schema": {
            "type": "string"
          },
          "name": "visitorId",
          "in": "path",
          "required": "true",
          "description": "The visitor ID."
        }
      ],
      "get": {
        "summary": "Get Livechat Visitor Chat History",
        "tags": [
          "Omnichannel Visitors"
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "history": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "_id": {
                            "type": "string"
                          },
                          "msgs": {
                            "type": "integer"
                          },
                          "usersCount": {
                            "type": "integer"
                          },
                          "lm": {
                            "type": "string"
                          },
                          "fname": {
                            "type": "string"
                          },
                          "t": {
                            "type": "string"
                          },
                          "ts": {
                            "type": "string"
                          },
                          "departmentId": {
                            "type": "string"
                          },
                          "v": {
                            "type": "object",
                            "properties": {
                              "_id": {
                                "type": "string"
                              },
                              "username": {
                                "type": "string"
                              },
                              "token": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              },
                              "lastMessageTs": {
                                "type": "string"
                              }
                            }
                          },
                          "cl": {
                            "type": "boolean"
                          },
                          "open": {
                            "type": "boolean"
                          },
                          "_updatedAt": {
                            "type": "string"
                          },
                          "departmentAncestors": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "lastMessage": {
                            "type": "object",
                            "properties": {
                              "_id": {
                                "type": "string"
                              },
                              "rid": {
                                "type": "string"
                              },
                              "msg": {
                                "type": "string"
                              },
                              "token": {
                                "type": "string"
                              },
                              "alias": {
                                "type": "string"
                              },
                              "ts": {
                                "type": "string"
                              },
                              "u": {
                                "type": "object",
                                "properties": {
                                  "_id": {
                                    "type": "string"
                                  },
                                  "username": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                }
                              },
                              "unread": {
                                "type": "boolean"
                              },
                              "_updatedAt": {
                                "type": "string"
                              },
                              "urls": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {}
                                }
                              },
                              "mentions": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {}
                                }
                              },
                              "channels": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {}
                                }
                              },
                              "md": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string"
                                    },
                                    "value": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string"
                                          },
                                          "value": {
                                            "type": "string"
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              },
                              "newRoom": {
                                "type": "boolean"
                              },
                              "showConnecting": {
                                "type": "boolean"
                              }
                            }
                          },
                          "metrics": {
                            "type": "object",
                            "properties": {
                              "reaction": {
                                "type": "object",
                                "properties": {
                                  "fd": {
                                    "type": "string"
                                  },
                                  "ft": {
                                    "type": "number"
                                  },
                                  "tt": {
                                    "type": "number"
                                  }
                                }
                              },
                              "response": {
                                "type": "object",
                                "properties": {
                                  "avg": {
                                    "type": "number"
                                  },
                                  "fd": {
                                    "type": "string"
                                  },
                                  "ft": {
                                    "type": "number"
                                  },
                                  "total": {
                                    "type": "integer"
                                  },
                                  "tt": {
                                    "type": "number"
                                  }
                                }
                              },
                              "v": {
                                "type": "object",
                                "properties": {
                                  "lq": {
                                    "type": "string"
                                  }
                                }
                              }
                            }
                          },
                          "waitingResponse": {
                            "type": "boolean"
                          }
                        }
                      }
                    },
                    "count": {
                      "type": "integer"
                    },
                    "offset": {
                      "type": "integer"
                    },
                    "total": {
                      "type": "integer"
                    },
                    "success": {
                      "type": "boolean"
                    }
                  }
                },
                "examples": {
                  "Success Example": {
                    "value": {
                      "history": [
                        {
                          "_id": "hhMKhHnnbY79mGs9K",
                          "msgs": "2",
                          "usersCount": "1",
                          "lm": "2021-07-22T17:17:04.937Z",
                          "fname": "Maria",
                          "t": "l",
                          "ts": "2021-07-22T17:17:04.216Z",
                          "departmentId": "CAJioQNAvLnYWTy8i",
                          "v": {
                            "_id": "QyBAKC5Wc8tcv6cco",
                            "username": "guest-537",
                            "token": "8s7e9ony6ctl27e1qf8kue",
                            "status": "online",
                            "lastMessageTs": "2021-07-22T17:17:04.937Z"
                          },
                          "cl": "false",
                          "open": "true",
                          "_updatedAt": "2021-07-22T17:17:05.078Z",
                          "departmentAncestors": [
                            "sriw2wmP2Zz2pPrre"
                          ],
                          "lastMessage": {
                            "_id": "YfrxZ6gmaYLpPTxFP",
                            "rid": "hhMKhHnnbY79mGs9K",
                            "msg": "hi",
                            "token": "8s7e9ony6ctl27e1qf8kue",
                            "alias": "Maria",
                            "ts": "2021-07-22T17:17:04.937Z",
                            "u": {
                              "_id": "QyBAKC5Wc8tcv6cco",
                              "username": "guest-537",
                              "name": "Maria"
                            },
                            "unread": "true",
                            "_updatedAt": "2021-07-22T17:17:05.044Z",
                            "urls": [],
                            "mentions": [],
                            "channels": [],
                            "md": [
                              {
                                "type": "PARAGRAPH",
                                "value": [
                                  {
                                    "type": "PLAIN_TEXT",
                                    "value": "hi"
                                  }
                                ]
                              }
                            ],
                            "newRoom": "false",
                            "showConnecting": "true"
                          },
                          "metrics": {
                            "reaction": {
                              "fd": "2021-07-22T17:17:04.449Z",
                              "ft": "0.233",
                              "tt": "0.233"
                            },
                            "response": {
                              "avg": "0.233",
                              "fd": "2021-07-22T17:17:04.449Z",
                              "ft": "0.233",
                              "total": "1",
                              "tt": "0.233"
                            },
                            "v": {
                              "lq": "2021-07-22T17:17:04.937Z"
                            }
                          },
                          "waitingResponse": "true"
                        }
                      ],
                      "count": "1",
                      "offset": "0",
                      "total": "1",
                      "success": "true"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/authorizationError"
          }
        },
        "operationId": "get-api-v1-livechat-visitors.chatHistory-room-roomId-visitor-visitorId",
        "parameters": [
          {
            "$ref": "#/components/parameters/AuthToken"
          },
          {
            "$ref": "#/components/parameters/UserId"
          },
          {
            "$ref": "#/components/parameters/offset"
          },
          {
            "$ref": "#/components/parameters/count"
          },
          {
            "$ref": "#/components/parameters/sort"
          }
        ]
      }
    }
  },
  "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."
                }
              }
            }
          }
        }
      }
    },
    "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."
      }
    }
  }
}
````

