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

# Conversation history

> Retrieve a preview of recent causal chat sessions for the authenticated user.

Returns a summary list of the authenticated user's most recent causal chat sessions, each with a preview of the last message. Use this endpoint to populate history panels or session pickers in your integration.

<Info>
  To retrieve the full message list for a specific session, use [GET /api/causal-chat/sessions/{sessionId}](/api/causal-chat/sessions).
</Info>

## Endpoint

```
GET /api/causal-chat/history
```

## Authentication

Required. Include a session cookie or `Authorization: Bearer <token>` header. Unauthenticated requests return `401 Unauthorized`.

## Request

This endpoint accepts no query parameters or request body.

### Headers

<ParamField header="Authorization" type="string" required>
  Bearer token for API authentication. Format: `Bearer <token>`.
</ParamField>

## Response

**Status:** `200 OK`\
**Content-Type:** `application/json`

Returns a list of recent sessions, each containing metadata and a preview of the last message. Sessions are ordered by most recently updated first.

<ResponseField name="sessions" type="object[]" required>
  Array of recent session objects.

  <Expandable title="session properties" defaultOpen={true}>
    <ResponseField name="id" type="string" required>
      UUID identifying the session. Pass this as `sessionId` in subsequent [POST /api/causal-chat](/api/causal-chat/send) requests to continue the conversation.
    </ResponseField>

    <ResponseField name="title" type="string" required>
      Title of the session, derived from the first question asked.
    </ResponseField>

    <ResponseField name="updated_at" type="string" required>
      ISO 8601 timestamp of the most recent message in the session.
    </ResponseField>

    <ResponseField name="domain_classified" type="string">
      Primary domain label for the session, e.g. `"neuroscience"` or `"economics"`. May be `null` if the first message has not yet been classified.
    </ResponseField>

    <ResponseField name="last_message" type="object">
      Preview of the most recent message in the session.

      <Expandable title="last_message properties">
        <ResponseField name="role" type="string" required>
          Role of the last message author: `"user"` or `"assistant"`.
        </ResponseField>

        <ResponseField name="content_preview" type="string" required>
          Truncated content of the last message, suitable for display in a list view.
        </ResponseField>

        <ResponseField name="created_at" type="string" required>
          ISO 8601 timestamp when the last message was created.
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

## Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl --request GET \
    --url https://wuweism.com/api/causal-chat/history \
    --header 'Authorization: Bearer <token>'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://wuweism.com/api/causal-chat/history', {
    headers: {
      'Authorization': 'Bearer <token>',
    },
  });
  const data = await response.json();
  console.log(data.sessions);
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://wuweism.com/api/causal-chat/history',
      headers={'Authorization': 'Bearer <token>'},
  )
  data = response.json()
  print(data['sessions'])
  ```
</CodeGroup>

```json 200 theme={null}
{
  "sessions": [
    {
      "id": "3f2504e0-4f89-11d3-9a0c-0305e82c3301",
      "title": "Does cortisol exposure causally increase hippocampal volume reduction?",
      "updated_at": "2026-04-05T14:32:00Z",
      "domain_classified": "neuroscience",
      "last_message": {
        "role": "assistant",
        "content_preview": "Yes. The causal pathway from elevated cortisol to hippocampal volume reduction is well-supported...",
        "created_at": "2026-04-05T14:32:00Z"
      }
    },
    {
      "id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
      "title": "What is the causal effect of sleep deprivation on reaction time?",
      "updated_at": "2026-04-04T09:15:00Z",
      "domain_classified": "cognitive_science",
      "last_message": {
        "role": "user",
        "content_preview": "Can you break down the adjustment set used in that analysis?",
        "created_at": "2026-04-04T09:15:00Z"
      }
    }
  ]
}
```

## Error responses

| Status | Description                                    |
| ------ | ---------------------------------------------- |
| `401`  | Missing or invalid authentication credentials. |
