User Profiles
Build user profiles through dialectic conversations. Hebbrix learns user preferences, interests, and personality traits to personalize AI responses.
01. How Profiles Work
Learned from conversations
Profiles are built automatically: facts a user states in chat turns (with features.learning, on by default) and in memories you process are added to that user's profile.
Dialectic Chat
Use the dialectic endpoint to have focused conversations that extract specific profile information.
02. Profile Fields
Profiles can store any structured data. Common fields include:
namepreferencesinterestsexpertisecommunication_stylegoalstimezonelanguageindustryrolepersonality_traitscustom_fields03. Endpoints
Get the current user's profile. Common keys like name, timezone and language are exposed at the top level for convenience; the full fact set lives under `profile.static` / `profile.dynamic`. Pass `user_id` to read one end user's profile (the same value you tag their memories with) and optionally `collection_id` to read one collection. Without `user_id` only account-level facts are returned, never another end user's; a collection holding end-user data requires `user_id` (400 `end_user_scope_required`). Learned facts follow the memories they came from: a fact whose source memories were all deleted, superseded by a correction or cancellation, or kept only as history is not served. Facts you set or confirm are always served. A second value beside the main one (a second job) is kept as `additional_<attribute>` with its own details, and keys follow one vocabulary and spelling (`job_title`, `employer`, `industry`, `programming_language`, `response_format`, `response_length`, `favorite_<thing>`).
Request body
| Field | Type | Description |
|---|---|---|
user_id | string? | Query param. Read one end user's profile: only facts derived from that end user's memories. Omit to read account-level facts only. |
collection_id | string? | Query param. Scope the read to one collection: returns only facts tagged to it (or derived from its memories). A collection holding end-user data also needs user_id. |
agent_id | string? | Query param. Read as this agent: facts learned without an agent plus the facts this agent learned, never another agent's. Omit to read user-level facts only. |
Response
| Field | Type | Description |
|---|---|---|
name | string? | Extracted from `profile.static`; top-level convenience. |
timezone | string? | Extracted from `profile.static`; top-level convenience. |
language | string? | Extracted from `profile.static`; top-level convenience. |
profile | object | Full fact-bucket structure with static and dynamic facts |
profile.static | array | Long-lived facts (e.g., name, timezone, role) |
profile.dynamic | array | Short-lived facts (e.g., current project, temporary state) |
profile.metadata | object | User id, retrieved_at, counts |
searchResults | object? | Present only when the request includes a search query |
metadata | object | Response-level metadata |
Update profile fields manually. Merged with auto-learned data. Optional reserved body keys sit alongside the fact map: `user_id` (the end user the facts belong to), `collection_id` (tags written facts to a collection) and `dry_run` (preview-only: returns the planned changes without persisting).
Request body
| Field | Type | Description |
|---|---|---|
name | string | User's name |
preferences | object | User preferences |
custom_fields | object | Custom profile data |
user_id | string | Reserved key. The end user the written facts belong to (alias end_user_id). Omit to write account-level facts. |
collection_id | string | Reserved key. Tags every written fact to this collection. Omit to write facts with no collection. |
dry_run | boolean | Reserved key. When true, returns a PREVIEW without persisting: {status:'preview', would_update:N, would_create:N, collection_id, changes:[...]}. |
Dialectic reasoning: ask natural language questions about a user. Also available at /v1/profile/chat. Send the prompt as `user_message` (preferred); `question`/`message` are kept as aliases.
Request body
| Field | Type | Description |
|---|---|---|
user_message | string | The prompt / question about the user. Preferred field. |
message | string | Legacy alias of `user_message`; still accepted. |
question | string | Legacy alias of `user_message`; still accepted. |
session_id | string | Optional caller-provided session id to correlate multi-turn conversations. Echoed back in the response. |
include_memories | boolean | Include relevant memories in reasoning (default: true) |
memory_limit | integer | Max memories for context (default: 10, max: 50) |
Response
| Field | Type | Description |
|---|---|---|
assistant_message | string | The assistant's natural-language answer. Preferred field for new integrations. |
response | string | Legacy alias of `assistant_message` (same value). |
session_id | string | Session identifier. Echoes the caller's value if provided, otherwise a fresh UUID is generated. |
question | string | The resolved question text |
reasoning | object | Reasoning metadata (profile_facts_used, memories_used, confidence) |
sources | object | Sources used: {profile_facts: [...], memories: [...]} |
metadata | object | Generation metadata (user_id, model, timestamp) |
Delete all profile data. This action is irreversible.
04. Per-Fact CRUD
Beyond the bulk PATCH, every profile fact can be read, created, edited, or removed individually. Each of these also honours the multi-tenant user_id and collection_id scoping described below.
List individual profile facts. Pass `user_id` for one end user's facts and optionally `collection_id` for one collection; without `user_id` only account-level facts are listed.
Request body
| Field | Type | Description |
|---|---|---|
user_id | string? | Query param. One end user's facts. Omit for account-level facts only. |
collection_id | string? | Query param. Scope the read to one collection (multi-tenant isolation). |
Create a single profile fact. Pass `user_id` to give the fact to one end user and optionally `collection_id` to tag it to a collection; omit both to write an account-level fact.
Request body
| Field | Type | Description |
|---|---|---|
keyrequired | string | Fact key (e.g. role, timezone, language). |
valuerequired | string | Fact value. |
user_id | string | The end user this fact belongs to (alias end_user_id). Omit for an account-level fact. |
collection_id | string | Tag this single fact to a collection. Omit for no collection. |
Update an existing profile fact in place, addressed by its key.
Delete a single profile fact by its unique id (handles duplicate keys precisely).
Delete a profile fact addressed by its key.
Audit log: returns every add / update / remove operation performed on this profile's facts, in chronological order.
05. Code Examples
Get User Profile
import requests
# GET /v1/profile
# Flat convenience fields (name/timezone/language) live at the top
# level; all other facts sit under the "profile.static" and
# "profile.dynamic" buckets.
r = requests.get(
"https://api.hebbrix.com/v1/profile",
headers={"Authorization": "Bearer <your-api-key>"},
)
data = r.json()
print(f"Name: {data.get('name')}")
print(f"Timezone: {data.get('timezone')}")
print(f"Language: {data.get('language')}")
# Every other fact lives under profile.static (long-lived) or
# profile.dynamic (short-lived). Each entry is {key, value, confidence, ...}.
for fact in data["profile"]["static"]:
print(f" static · {fact['key']} = {fact['value']}")
for fact in data["profile"]["dynamic"]:
print(f" dynamic · {fact['key']} = {fact['value']}")Dialectic Conversation
import requests
# POST /v1/profile/dialectic: ask natural-language questions about the user.
# Send the prompt as `user_message` (preferred); legacy `message` / `question`
# are still accepted.
r = requests.post(
"https://api.hebbrix.com/v1/profile/dialectic",
headers={"Authorization": "Bearer <your-api-key>"},
json={"user_message": "What are this user's main professional interests?"},
)
body = r.json()
# Preferred response fields
print(body["assistant_message"]) # the LLM answer
print(body["session_id"]) # echo back in the next turn for continuity
# Legacy alias (same value as assistant_message)
# body["response"] is also available for older integrations.
# Continue the conversation: reuse session_id to link turns
r2 = requests.post(
"https://api.hebbrix.com/v1/profile/dialectic",
headers={"Authorization": "Bearer <your-api-key>"},
json={
"user_message": "Tell me more about how they like to communicate.",
"session_id": body["session_id"],
},
)Update Profile Manually
import requests
# PATCH /v1/profile: bulk-update profile facts. Body is a flat
# {fact_key: fact_value} dict. Existing facts are updated; new ones
# are created as "static" / "other" automatically.
r = requests.patch(
"https://api.hebbrix.com/v1/profile",
headers={"Authorization": "Bearer <your-api-key>"},
json={
"name": "John Doe",
"timezone": "UTC",
"language": "en",
"role": "Senior Engineer",
"company": "Acme Inc",
},
)
body = r.json()
print(body["status"]) # "success"
print(body["updated"]) # count of facts updated in place
print(body["created"]) # count of new facts created
print(body["message"]) # e.g. "Updated 3, created 2 profile facts"06. cURL Example
/v1/profilecurl -X GET "https://api.hebbrix.com/v1/profile" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"07. Profile Injection in Chat
When a chat completion names its end user, that user's profile is injected automatically:
import os
import requests
BASE = "https://api.hebbrix.com/v1"
H = {"Authorization": f"Bearer {os.environ['HEBBRIX_API_KEY']}"}
# POST /v1/chat/completions: name the end user (OpenAI's user field) and
# keep features.user_profile=True to have that user's profile facts
# injected into the context automatically. Without user (or collection_id)
# the call is answered without memory or profile.
r = requests.post(
f"{BASE}/chat/completions",
headers=H,
json={
"model": "gpt-5-nano",
"user": "user-123", # each end user gets their own profile
"messages": [
{"role": "user", "content": "Recommend a book for me"},
],
"features": {
"memory": True,
"user_profile": True, # inject profile context
},
},
)
# The assistant sees the caller's profile and gives a personalized answer
print(r.json()["choices"][0]["message"]["content"])08. Multi-Tenant Scoping (user_id)
If you run a multi-tenant SaaS where many end-users share one Hebbrix account, pass each end user's user_id on every profile read and write (the same value you tag their memories with). A read with user_id returns only that end user's facts, so one end-user's profile never leaks into another's. A collection_id narrows a read to one collection; it is not an end-user boundary on its own.
Isolation model
- A fact written without a
user_idis an account-level fact. - A read with
user_idreturns only facts derived from that end user's memories (plus facts you wrote for them); withcollection_idas well, only those tagged to or derived from that collection. - A read without
user_idreturns account-level facts only, never all end users'. A collection that holds end-user data refuses a read withoutuser_idwith400 end_user_scope_required.
Agent scope
A fact learned under an agent_id belongs to that agent. A read scoped to an agent sees the facts learned without an agent plus that agent's own, never another agent's, however long ago they were stored. A read with no agent sees user-level facts only, so pass the agent's agent_id to read what it learned. This applies to search with include_profile: true, POST /v1/profile (and GET /v1/profile with the agent_id query parameter) and chat.
The profile that search returns with include_profile: true names the exact scope it was read for in profile.scope (collection_id, end_user_id, agent_id) and says in profile.projection whether recent writes of that scope are in it yet: status is pending while a fact may still appear or change (pending_writes counts the unfinished writes, capped: true when there are at least that many), ready once every accepted write is reflected, and failed when nothing is pending and failed_writes writes will not be reflected unless their batch is retried (failure.reason says why; POST /v1/memories/batches/{id}/retry restarts it). A small write normally reaches the profile within seconds of becoming searchable. profile.status: "ok" means only that the read succeeded. To read the profile a write produced, poll every retry_after_seconds (2 s, backing off to about 10 s) until projection.status is ready or failed, as in the chatbot memory guide. For one specific write, read stages.profile on its readiness_url.
Where it applies
GET /v1/profile, GET /v1/profile/facts (query param), PATCH /v1/profile and POST /v1/profile/facts (body key).
Preview before you write
Send dry_run: true on PATCH /v1/profile to get a preview of the planned changes (would_update / would_create) without persisting anything.
Scoped Write with Dry-Run Preview
import requests
BASE = "https://api.hebbrix.com/v1"
H = {"Authorization": "Bearer <your-api-key>"}
# The end user's id in your app, and a collection you created
# (POST /v1/collections returns its id).
USER_ID = "user-123"
COLLECTION = "YOUR_COLLECTION_ID"
# 1) PREVIEW: dry_run returns the planned changes WITHOUT persisting.
preview = requests.patch(
f"{BASE}/profile",
headers=H,
json={
"role": "Product Manager",
"timezone": "America/New_York",
"user_id": USER_ID, # reserved key: whose facts these are
"collection_id": COLLECTION, # reserved key: tags the facts
"dry_run": True, # reserved key: preview only
},
).json()
print(preview["status"]) # "preview"
print(preview["would_update"]) # N facts that would be updated in place
print(preview["would_create"]) # N facts that would be created
print(preview["collection_id"]) # the collection you passed
print(preview["changes"]) # [...] per-fact diff, nothing written yet
# 2) REAL WRITE: drop dry_run (or set it False) to persist the facts
# for this end user, so they stay isolated.
written = requests.patch(
f"{BASE}/profile",
headers=H,
json={
"role": "Product Manager",
"timezone": "America/New_York",
"user_id": USER_ID,
"collection_id": COLLECTION,
},
).json()
print(written["status"]) # "success"
print(written["updated"], written["created"])
# 3) SCOPED READ: only this end user's facts come back; another
# end-user's profile never leaks in.
profile = requests.get(
f"{BASE}/profile",
headers=H,
params={"user_id": USER_ID, "collection_id": COLLECTION},
).json()
for fact in profile["profile"]["static"]:
print(f" {fact['key']} = {fact['value']}")