# XataChatMessageHistory

> **Class** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/chat_message_histories/xata/XataChatMessageHistory)

Chat message history stored in a Xata database.

## Signature

```python
XataChatMessageHistory(
    self,
    session_id: str,
    db_url: str,
    api_key: str,
    branch_name: str = 'main',
    table_name: str = 'messages',
    create_table: bool = True,
)
```

## Extends

- `BaseChatMessageHistory`

## Constructors

```python
__init__(
    self,
    session_id: str,
    db_url: str,
    api_key: str,
    branch_name: str = 'main',
    table_name: str = 'messages',
    create_table: bool = True,
) -> None
```

| Name | Type |
|------|------|
| `session_id` | `str` |
| `db_url` | `str` |
| `api_key` | `str` |
| `branch_name` | `str` |
| `table_name` | `str` |
| `create_table` | `bool` |


## Properties

- `messages`

## Methods

- [`add_message()`](https://reference.langchain.com/python/langchain-community/chat_message_histories/xata/XataChatMessageHistory/add_message)
- [`clear()`](https://reference.langchain.com/python/langchain-community/chat_message_histories/xata/XataChatMessageHistory/clear)

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/a6a6079511ac8a5c1293337f88096b8641562e77/libs/community/langchain_community/chat_message_histories/xata.py#L12)