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

# Learn screen

> How to render the Learn screen by fetching the Learn API endpoints

The Learn screen aggregates investor education content across four streams:

* Analyst Insights
* Learning Guides
* News
* Glossary

<Info>
  You render the Learn screen by fetching the Learn API endpoints and composing the results into your UI. See the API Reference → Learn API for full schemas and examples.
</Info>

## Prerequisites

* Backend access to the Learn endpoints
* Bearer token with `read:users` scope
* `x-user-id` header for subscription-aware trimming

## What to fetch

<AccordionGroup>
  <Accordion title="Analyst Insights (feed)">
    Use `GET /analyst-insights?page=1` to fetch the paginated editorial feed. Paid users receive full HTML; non-paid receive trimmed content.
  </Accordion>

  <Accordion title="Analyst Insight (detail)">
    Use `GET /analyst-insights/{id}` for the full entry when a user opens a story.
  </Accordion>

  <Accordion title="Learning Guides (catalogue)">
    Use `GET /learning-guides` to render the carousel with guide metadata. Each guide includes an `id` field (MongoDB document identifier) that you can use to fetch the full guide content.
  </Accordion>

  <Accordion title="Learning Guide (by slug or id)">
    Use `GET /learning-guides/slug/{slug}` or `GET /learning-guides/{id}` to fetch chapters for the detail view. The `id` parameter should be the MongoDB document identifier from the guide's `id` field in the catalogue response.
  </Accordion>

  <Accordion title="News">
    Use `GET /news` to fetch the latest stories with Cloudflare-resized images. Each news item includes an `id` field that you can use to fetch the full article via `GET /news/{id}`.
  </Accordion>

  <Accordion title="News Stories">
    Stories are sourced from the `GET /news` endpoint and filtered client-side to show items from the past 3 days.

    **Required fields for story display:**

    * `fullImageURL` — Background image when a story is opened
    * `previewTitleMain` — Primary title text (bold)
    * `previewTitleSecondary` — Secondary title text (regular)
    * `createdAt` — Creation date
    * `id` — Unique identifier

    **Opening articles from stories:**

    * Tapping "Read more" uses the same news item object from the stories array
    * No additional API call is needed; data is reused from the initial response
    * The `contentHTML` field contains the full article HTML content

    **Field reference table:**

    | Use Case              | Field Name              | Description                   |
    | --------------------- | ----------------------- | ----------------------------- |
    | Story thumbnail       | `storyImageURL`         | Circular thumbnail in list    |
    | Story background      | `fullImageURL`          | Full-screen image when opened |
    | Story title (bold)    | `previewTitleMain`      | Primary title text            |
    | Story title (regular) | `previewTitleSecondary` | Secondary title text          |
    | Story date            | `createdAt`             | Creation date                 |
    | Article content       | `contentHTML`           | Full article HTML content     |
    | Article identifier    | `id`                    | Unique story/article ID       |
  </Accordion>

  <Accordion title="Glossary">
    Use `GET /glossary` to populate the glossary section.
  </Accordion>
</AccordionGroup>

## Example: minimal client fetch

<CodeGroup>
  ```javascript Node.js theme={null}
  const BASE = 'https://api.wealthyhood.com/learn';

  async function fetchAnalystInsights({ token, userId, page = 1 }) {
    const res = await fetch(`${BASE}/analyst-insights?page=${page}`, {
      headers: {
        'Authorization': `Bearer ${token}`,
        'x-user-id': userId,
        'Accept': 'application/json'
      }
    });
    if (!res.ok) throw new Error(`Failed: ${res.status}`);
    return res.json();
  }
  ```

  ```bash cURL theme={null}
  curl -X GET 'https://api.wealthyhood.com/learn/analyst-insights?page=1' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
    -H 'x-user-id: 64f0c51e7fb3fc001234abcd'
  ```
</CodeGroup>

<Tip>
  When rendering HTML content fields like `contentHTML` or `definitionHTML`, sanitize or trust the known-safe origin according to your app's security model.
</Tip>

## See also

* API Reference → Learn API → `GET /analyst-insights`, `GET /learning-guides`, `GET /news`, `GET /glossary`
* Detail endpoints for full entries
