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

# get_chat_history

> Fetch the full message history for a specific chat conversation

<Tabs>
  <Tab title="Sync">
    ```python theme={null}
    def get_chat_history(chat_id: str) -> List[Dict[str, Any]]
    ```
  </Tab>

  <Tab title="Async">
    ```python theme={null}
    async def get_chat_history(chat_id: str) -> List[Dict[str, Any]]
    ```
  </Tab>
</Tabs>

## Parameters

* `chat_id` (str): Identifier of the conversation to retrieve.

## Returns

* `List[Dict[str, Any]]`: A list of message dictionaries in chronological order.

Each message dictionary contains:

* `role` – either `"user"` or `"assistant"`
* `content` – the original text of the message
* `timestamp` – ISO-8601 timestamp string

## Example

<Tabs>
  <Tab title="Sync">
    ```python theme={null}
    db = Morphik()
    history = db.get_chat_history("chat_123")
    for msg in history:
        print(f"[{msg['role']}] {msg['content']}")
    ```
  </Tab>

  <Tab title="Async">
    ```python theme={null}
    async with AsyncMorphik() as db:
        history = await db.get_chat_history("chat_123")
        print(history[-1])
    ```
  </Tab>
</Tabs>
