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

# AI Conversation

> Retrieve conversation history from a channel

## Overview

API endpoint for retrieving conversation history from a channel or session. This endpoint allows you to access previous interactions with your AI.

## Authorization

<ParamField header="x-api-key" type="string" required>
  Your Personal AI API key
</ParamField>

## Headers

<ParamField header="Content-Type" type="string" required>
  Must be set to application/json
</ParamField>

## Body

<ParamField body="DomainName" type="string" required>
  The hyphenated text below the AI's name when clicked into a Persona.

  <img alt="DomainName" classname="block dark:hidden" src="https://mintcdn.com/personalai/kGsTZefXJjPC-_P1/images/domainname.png?fit=max&auto=format&n=kGsTZefXJjPC-_P1&q=85&s=36b7c320c44dba9f962cdb342de41f3a" width="1140" height="416" data-path="images/domainname.png" />

  ```json Example Request theme={null}
  "DomainName": "product-demo-jebzrhw"
  ```
</ParamField>

<ParamField body="SessionId" type="string" required>
  Session identifier to retrieve specific conversation history

  ```json Example Request theme={null}
  "SessionId": "dd3ec564-5948-4da0-8ab6-94b23f92705b"
  ```
</ParamField>

## Example Request

<ResponseField name="array" type="array">
  Array of conversation messages, including both user messages and AI responses
</ResponseField>

```json Example Request theme={null}
{
  "SessionId": "dd3ec564-5948-4da0-8ab6-94b23f92705b",
  "DomainName": "product-demo-jebzrhw"
}
```

## Example Response

```json Example Success Response theme={null}
[
    {
        "ai_message": "what is a personal AI",
        "ai_score": 0.0,
        "ai_name": "AI Name",
        "ai_picture": null,
        "raw_message": "what is a personal AI",
        "timestamp": "2024-09-16T03:52:40.821Z",
        "SessionId": "98bf4dd5-5ab0-4d28-a439-d2f2d18d5443",
        "Metadata": {}
    },
    {
        "ai_message": "A personal AI is a digital extension of your mind...",
        "ai_score": 0.0,
        "ai_name": "AI Name",
        "ai_picture": null,
        "raw_message": "A personal AI is a digital extension of your mind...",
        "timestamp": "2024-09-16T03:52:40.822Z",
        "SessionId": "98bf4dd5-5ab0-4d28-a439-d2f2d18d5443",
        "Metadata": {}
    }
]
```

## Example cURL

```bash cURL theme={null}
curl --location 'https://api.personal.ai/v1/conversation' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <your-api-key>' \
--data '{
  "SessionId": "dd3ec564-5948-4da0-8ab6-94b23f92705b",
  "DomainName": "product-demo-jebzrhw"
}'
```

## Error Codes

| Code | Description                                   |
| ---- | --------------------------------------------- |
| 403  | Forbidden - Check that API key is invalid     |
| 404  | Not Found - Conversation or session not found |
