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

> [tab] Sync
>
> ```python theme={null}
> def get_chat_history(chat_id: str) -> List[Dict[str, Any]]
> ```

> [tab] Async
>
> ```python theme={null}
> async def get_chat_history(chat_id: str) -> List[Dict[str, Any]]
> ```

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

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

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


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.