# Profile

> What is true about one app user now, as a short text to put in your system prompt, and the same lines one by one.

`POST /v2/memory/profile`

- Auth: read key
- Cost: free; never refused for your plan

Profile answers one question with no question asked: what should my assistant know about this person before it
replies? It returns the known lines, what memory holds to be true now, as one `text` ready for a system prompt,
within a size you set. Call it once at the start of a conversation; [search](/api/search) for what the person
asks.

The lines come in this order, each section under its heading: `How they asked to be helped`, `What they
saved`, `What is true now` (values as they stand, newest said first), `What they prefer` and `Coming up`. When they don't
all fit in `max_tokens`, the ones that do come first; [`summary`](/api/summary) has every line. The profile is
as of today in UTC, so what is coming up is counted from that day; `summary` takes the person's own date.

`GET /v2/memory/profile` is the same call, with `max_tokens` in the address:
`/v2/memory/profile?max_tokens=800`.

## Headers

- `Authorization` (string, required): `Bearer ax_…`. A read key is enough.
- `X-Alexein-User` (string, required): The app user whose profile to read. See [App users](/concepts/app-users).
- `X-Request-Id` (string): Your id for this request, echoed on the response.

## Body

- `max_tokens` (integer): The most tokens `text` takes, counted on the generous side, so it stays under this for the common models.
  50 to 4,000. Default `400`. Send `{}`, or no body, for the default.

## Response

- `text` (string): The lines under their headings, ready to put in a prompt as it is. Empty when memory knows nothing of the
  person yet.
- `lines` (object[]): The lines in `text`, in its order, each `{type, text, section, from, ref}` as [`summary`](/api/summary) lists
  them: `section` is `rules`, `saved`, `current`, `preferences` or `coming_up`; `from` is who said it (`user`,
  `other` for someone else, `assistant`, or `null` when not known); `ref` is the fact it came from, or `null`
  for a line made of several.
- `updating` (boolean): `true` while memory is still reading what was lately added, forgotten or corrected, so the profile is about
  to change.

A line appears once its item is `processed`, usually within minutes of the add; a note an app user saves in
their own words (`author.self`) appears at once. Lines resting on anything the person asked memory to
[forget](/api/forget), or on a fact you [corrected](/api/correct), are not shown. For an app user with no memory
yet it answers `200` with `text` empty and `lines` `[]`.

Profile is free: it is never counted as a search.

## Errors

- `400` (bad request): `X-Alexein-User` is missing or not a usable id.
- `401` (unauthorized): The bearer is not a key this service issued.
- `403` (forbidden): The organisation has been closed in the console.
- `422` (invalid): A `max_tokens` under 50 or over 4,000, or not a whole number.
- `429` (too many requests): Past your organisation's rate limits, or this app user has too many requests in flight or reads too fast.
  Retry after `Retry-After` seconds. See [Limits](/concepts/limits#rate-limits).
- `503` (unavailable): The service is busy or briefly unavailable. Retry after `Retry-After` seconds, or with backoff when
  there is none.
**cURL**

```bash title="Request"
curl https://api.alexein.ai/v2/memory/profile \
  -H "Authorization: Bearer $ALEXEIN_API_KEY" \
  -H "X-Alexein-User: user_42"
```
**Python**

```python title="Request"
from alexein import Memory

profile = Memory().user("user_42").profile()
system = f"You are a helpful assistant.\n\nWhat you know about this user:\n{profile.text}"
```
**TypeScript**

```ts title="Request"
import { Memory } from "@alexein/sdk";

const profile = await new Memory().user("user_42").profile();
const system = `You are a helpful assistant.\n\nWhat you know about this user:\n${profile.text}`;
```

```json title="200 OK"
{
  "text": "How they asked to be helped:\n- Alice wants answers in British English [said 2026-09-14, 78 days ago]\n\nWhat is true now:\n- Alice Chen · home city: Lisbon [said 2026-10-01, 61 days ago]; Berlin [said 2024-06-01, 913 days ago]\n\nWhat they prefer:\n- Alice Chen · diet: vegan [said 2026-10-02, 60 days ago]",
  "lines": [
    {
      "type": "known",
      "text": "Alice wants answers in British English [said 2026-09-14, 78 days ago]",
      "section": "rules",
      "from": "user",
      "ref": "mem_K32NVfBr35x-wxMTpl8vMQ3GY-IatUcR7tFtUwmux9HWPp6r3Krn9M"
    },
    {
      "type": "known",
      "text": "Alice Chen · home city: Lisbon [said 2026-10-01, 61 days ago]; Berlin [said 2024-06-01, 913 days ago]",
      "section": "current",
      "from": null,
      "ref": null
    },
    {
      "type": "known",
      "text": "Alice Chen · diet: vegan [said 2026-10-02, 60 days ago]",
      "section": "preferences",
      "from": "user",
      "ref": "mem_svPomWn9AVKcEcDTO-BCdIYk-7JZvfUg3hpgY4ZxrJ_4XtO9S0MG-Z"
    }
  ],
  "updating": false
}
```

```json title="200 OK, for an app user with no memory yet"
{ "text": "", "lines": [], "updating": false }
```
