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

# End-User Memory

> Personalize answers across sessions with remembered end-user profiles. Pass user context into the Guru via the Upsert Profiles API.

End-User Memory lets your Guru tailor its answers to the person asking. You pass an end-user profile (name, plan, region, history, anything else useful) into Gurubase via the [Upsert Profiles](/api-reference/endpoints/upsert-profiles) API. When that same user asks a question, the Guru uses the stored profile as context, so answers stay consistent across sessions, channels, and devices.

This is the Memory-Powered Personalization feature surfaced as a first-class product capability.

## What Memory Unlocks

<CardGroup cols={3}>
  <Card title="Plan-Aware Answers" icon="user-pen">
    A Pro-plan customer asking about quotas sees Pro-plan limits; a Free user sees Free limits, automatically.
  </Card>

  <Card title="Cross-Session Continuity" icon="history">
    The Guru remembers what was asked yesterday, last week, and last quarter without re-asking the user every time.
  </Card>

  <Card title="Per-User Refusals" icon="lock">
    Combine memory with source-level RBAC so the Guru only cites what each user is entitled to see.
  </Card>
</CardGroup>

## How It Works

<Steps>
  <Step title="Identify the user">
    Generate or reuse a stable `external_user_id` for each end user in your application. This is the key Gurubase will use to look up the user's memory.
  </Step>

  <Step title="Upsert the profile">
    Call [`POST /{guru_slug}/profiles/`](/api-reference/endpoints/upsert-profiles) with a JSON `memory` object. The structure is up to you - name, plan, region, account tier, recent activity, anything that helps the Guru answer better.
  </Step>

  <Step title="Pass the user into questions">
    When the user asks a question, include the same `external_user_id` in your [Ask Question](/api-reference/endpoints/ask-question) call. The Guru pulls the stored profile and grounds its answer with both the knowledge base **and** the user context.
  </Step>

  <Step title="Update over time">
    Re-upsert the profile whenever something changes (plan change, new permission, new context). The Upsert endpoint is idempotent, so you can safely call it on every relevant event.
  </Step>
</Steps>

## Example Profile Payload

```json theme={null}
POST /{guru_slug}/profiles/
{
  "users": [
    {
      "external_user_id": "user-7f3a-9b21",
      "memory": {
        "name": "Sarah E.",
        "email": "sarah@example.com",
        "plan": "Pro",
        "region": "EU",
        "department": "Sales",
        "preferred_language": "English",
        "last_topics": ["pricing", "renewal"]
      }
    }
  ]
}
```

The `memory` object structure is fully open. Pass whatever your application knows about the user that the Guru should use as context.

## Pairs Well With

<CardGroup cols={2}>
  <Card title="Smart Triage" icon="route" href="/guides/triage">
    Triage uses memory to skip clarifying questions the Guru already knows the answer to.
  </Card>

  <Card title="Actions" icon="zap" href="/guides/actions">
    Actions can use memory fields (e.g. `customer_email`, `plan`) as parameters when calling your APIs.
  </Card>

  <Card title="PII Masking" icon="shield-user" href="/guides/pii-masking">
    Mask personal data in answers and logs even while the Guru uses it as context internally.
  </Card>

  <Card title="Audit Logs" icon="clipboard-list" href="/guides/audit-logs">
    Every memory-informed answer is logged with the `external_user_id` that drove it.
  </Card>
</CardGroup>

## API Reference

* [Upsert User Profiles](/api-reference/endpoints/upsert-profiles) - Create or update profiles in bulk
* [Ask Question](/api-reference/endpoints/ask-question) - Ask a question scoped to an `external_user_id`
