Users & Personalization
Track end users, scope memories per user, track events, and handle GDPR erasure.
Users let you scope memories and queries to individual end users. Each user gets their own knowledge silo — when you pass userId to create or query, MemoryKit only retrieves that user's data.
Why use users?
Each user has their own memories. Queries only return their data.
One project serves many users without data leaking between them.
Delete a user and all their data in one API call.
Create or update a user
The upsert endpoint is idempotent — call it on every login or session start. If the user exists, fields are updated.
User-scoped memories
Pass userId when creating memories to assign them to a user. Then pass userId when querying to only retrieve that user's data.
Memories without a userId are shared across all users in the project. Use this for company-wide knowledge (help docs, policies, etc.) that every user should be able to access.
Track events
Record user activity for analytics and personalization. Events are tied to a user and can be filtered by type.
Get user profile
Delete user (GDPR erasure)
Delete a user and optionally cascade to all their memories, chats, and events. This is your GDPR "right to erasure" implementation.
With cascade=true, all memories, chats, and events associated with the user are permanently deleted. This action cannot be undone.