> ## Documentation Index
> Fetch the complete documentation index at: https://supermemory-capy-add-llmstxt-summary-and.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# User profiles

> Fetch and use automatically maintained user context

User profiles are extremely short summaries of context about an entity (Usually a user, but can be anything) which includes both the *static* facts about them, as well as a few recent episodes.

> You can think of these as a dynamic compaction that's done by supermemory in real-time.

This profile should be injected into the agent context for truly personalized experiences. To read more, visit [User profiles - Concept](/concepts/user-profiles)

Get a user's profile — their static facts and dynamic context — with a single API call.

<Tip>
  Profiles are built automatically as you [ingest content](/ingestion/add-memories). No setup required.
</Tip>

## Quick start

<Tabs>
  <Tab title="TypeScript">
    ```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
    import Supermemory from 'supermemory';

    const client = new Supermemory();

    const { profile } = await client.profile({
      containerTag: "user_123"
    });

    console.log(profile.static);   // Long-term facts
    console.log(profile.dynamic);  // Recent context
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
    from supermemory import Supermemory

    client = Supermemory()

    result = client.profile(container_tag="user_123")

    print(result.profile.static)   # Long-term facts
    print(result.profile.dynamic)  # Recent context
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
    curl -X POST "https://api.supermemory.ai/v4/profile" \
      -H "Authorization: Bearer $SUPERMEMORY_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"containerTag": "user_123"}'
    ```
  </Tab>
</Tabs>

**Response:**

```json theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
{
  "profile": {
    "static": [
      "User is a software engineer",
      "User specializes in Python and React",
      "User prefers dark mode interfaces"
    ],
    "dynamic": [
      "User is working on Project Alpha",
      "User recently started learning Rust",
      "User is debugging authentication issues"
    ]
  }
}
```

***

## Profile + search

Get profile and search results in one call by adding the `q` parameter:

<Tabs>
  <Tab title="TypeScript">
    ```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
    const result = await client.profile({
      containerTag: "user_123",
      q: "deployment errors"
    });

    // Profile data
    const { static: facts, dynamic: context } = result.profile;

    // Search results (only if q was provided)
    const memories = result.searchResults?.results || [];
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
    result = client.profile(
        container_tag="user_123",
        q="deployment errors"
    )

    # Profile data
    facts = result.profile.static
    context = result.profile.dynamic

    # Search results
    memories = result.search_results.results if result.search_results else []
    ```
  </Tab>
</Tabs>

***

## Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `containerTag` | string | Yes | User/project identifier |
| `q` | string | No | Search query (includes search results in response) |
| `threshold` | 0-1 | No | Filter search results by relevance score |
| `filters` | object | No | Metadata filters applied to profile and search results |
| `include` | string\[] | No | Sections to return — any of `"static"`, `"dynamic"`, `"buckets"`. Omit to return all |
| `buckets` | string\[] | No | Restrict the `buckets` section to specific keys. Omit for all configured buckets. See [Profile Buckets](/user-profiles/buckets) |

***

## Filtering profiles

Profiles support the same [metadata filters](/concepts/filtering) as `/search` and `/documents/list` — `filters` narrows which memories are eligible to contribute to `static`, `dynamic`, and `buckets`, not just which search results come back.

<Tabs>
  <Tab title="TypeScript">
    ```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
    const { profile } = await client.profile({
      containerTag: "user_123",
      filters: {
        AND: [{ key: "source", value: "onboarding" }],
      },
    });
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
    result = client.profile(
        container_tag="user_123",
        filters={"AND": [{"key": "source", "value": "onboarding"}]},
    )
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
    curl -X POST "https://api.supermemory.ai/v4/profile" \
      -H "Authorization: Bearer $SUPERMEMORY_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "containerTag": "user_123",
        "filters": { "AND": [{ "key": "source", "value": "onboarding" }] }
      }'
    ```
  </Tab>
</Tabs>

Combine `filters` with `q` to scope both the profile synthesis and the accompanying search results in one call:

```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
const result = await client.profile({
  containerTag: "org_customer_442",
  q: "billing issue",
  filters: {
    AND: [{ key: "channel", value: "support_ticket" }],
  },
});
```

All filter types from [Organizing & Filtering](/concepts/filtering) are supported — string equality, `string_contains`, `numeric`, `array_contains`, nested `AND`/`OR`, and `negate`.

***

## Building prompts

The most common pattern — inject profile into your LLM's system prompt:

```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
async function chat(userId: string, message: string) {
  const { profile } = await client.profile({ containerTag: userId });

  const systemPrompt = `You are assisting a user.

ABOUT THE USER:
${profile.static?.join('\n') || 'No profile yet.'}

CURRENT CONTEXT:
${profile.dynamic?.join('\n') || 'No recent activity.'}

Personalize responses to their expertise and preferences.`;

  return llm.chat({
    messages: [
      { role: "system", content: systemPrompt },
      { role: "user", content: message }
    ]
  });
}
```

***

## Full context pattern

Get profile + query-specific memories in one call:

```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
async function getContext(userId: string, query: string) {
  const result = await client.profile({
    containerTag: userId,
    q: query,
    threshold: 0.6
  });

  return `
User Background:
${result.profile.static.join('\n')}

Current Context:
${result.profile.dynamic.join('\n')}

Relevant Memories:
${result.searchResults?.results.map(m => m.memory).join('\n') || 'None'}
  `;
}
```

***

## Profile buckets

Buckets are **custom topical categories** for a profile — an axis that sits alongside
`static` and `dynamic`, grouping facts by subject (e.g. `preferences`, `goals`,
`work`) instead of by how long-lived they are.

<Card title="Profile buckets" icon="https://mintcdn.com/supermemory-capy-add-llmstxt-summary-and/LIMkcglt81IfjBVR/icons/hugeicons/tag-01.svg?fit=max&auto=format&n=LIMkcglt81IfjBVR&q=85&s=fbe615fd03d59490e31fccc12000ffc4" href="/user-profiles/buckets" width="24" height="24" data-path="icons/hugeicons/tag-01.svg">
  Read and configure buckets — request bucketed profiles, create org/space buckets,
  get AI-generated bucket suggestions, and see validation limits.
</Card>

***

## Framework examples

<Accordion title="Express.js middleware">
  ```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
  async function withProfile(req, res, next) {
    if (!req.user?.id) return next();

    try {
      const { profile } = await client.profile({
        containerTag: req.user.id
      });
      req.userProfile = profile;
    } catch (e) {
      req.userProfile = null;
    }
    next();
  }

  app.use(withProfile);

  app.post('/chat', (req, res) => {
    // req.userProfile available in all routes
  });
  ```
</Accordion>

<Accordion title="Next.js API route">
  ```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
  // app/api/chat/route.ts
  export async function POST(req: NextRequest) {
    const { userId, message } = await req.json();

    const { profile } = await client.profile({
      containerTag: userId
    });

    const response = await generateResponse(message, profile);
    return NextResponse.json({ response });
  }
  ```
</Accordion>

<Accordion title="AI SDK integration">
  ```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
  import { withSupermemory } from "@supermemory/tools/ai-sdk"
  import { openai } from "@ai-sdk/openai"

  // Profiles automatically injected
  const model = withSupermemory(openai("gpt-4"), {
    containerTag: "user-123",
    customId: "conv-1",
  })

  const result = await generateText({
    model,
    messages: [{ role: "user", content: "Help with my project" }]
  });
  ```

  See [AI SDK Integration](/integrations/ai-sdk) for details.
</Accordion>

***

## Response schema

```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
interface ProfileResponse {
  profile: {
    static?: string[];                    // Long-term facts
    dynamic?: string[];                   // Recent context
    buckets?: Record<string, string[]>;   // Topical buckets, keyed by bucket key
  };
  searchResults?: {     // Only if q parameter provided
    results: SearchResult[];
    total: number;
    timing: number;
  };
}
```

***

## Next steps

* [Profile Buckets](/user-profiles/buckets) — Custom topical categories for profiles
* [User Profiles Concept](/concepts/user-profiles) — Understand static vs dynamic
* [Ingesting Content](/ingestion/add-memories) — Build profiles by adding content
* [AI SDK Integration](/integrations/ai-sdk) — Automatic profile injection


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