mem0

Mem0 Platform SDK for adding persistent memory to AI applications. TRIGGER when: user mentions "mem0", "MemoryClient", "memory layer", "remember user preferences", "persistent context", "personalization", or needs to add long-term memory to chatbots, agents, or AI apps. Covers Python SDK (mem0ai), TypeScript SDK (mem0ai), and framework integrations (LangChain, CrewAI, OpenAI Agents SDK, Pipecat, LlamaIndex, AutoGen, LangGraph). Also covers the open-source self-hosted Memory class. This is the DEFAULT mem0 skill for ambiguous queries. DO NOT TRIGGER when: user asks about CLI commands, terminal usage, or shell scripts (use mem0-cli), or Vercel AI SDK / @mem0/vercel-ai-provider / createMem0 (use mem0-vercel-ai-sdk).

Install
npx skills add 'https://github.com/mem0ai/mem0/tree/main/skills/mem0'
Download bundle ↓
main · 0df3e4bScanned 2026-09-17

Contributors

GitHub-linked commit authors for this SKILL.md at the saved revision. Co-authors and history before file renames are not included.

File history ↗
View on GitHub
← Back to SKILL.md

Mem0 Platform API Reference

REST API endpoints for the Mem0 Platform. Base URL: https://api.mem0.ai

All endpoints require: Authorization: Token <MEM0_API_KEY>

Endpoints

OperationMethodURL
Add MemoriesPOST/v3/memories/add/
Search MemoriesPOST/v3/memories/search/
Get All MemoriesPOST/v3/memories/
Get Single MemoryGET/v1/memories/{memory_id}/
Update MemoryPUT/v1/memories/{memory_id}/
Delete MemoryDELETE/v1/memories/{memory_id}/

Note: v1/v2 endpoints still work (backward compatible).

Memory Object Structure

FieldTypeDescription
idstring (UUID)Unique memory identifier
memorystringText content of the memory
user_idstringAssociated user
agent_idstring (nullable)Agent identifier
app_idstring (nullable)Application identifier
run_idstring (nullable)Run/session identifier
metadataobjectCustom key-value pairs
categoriesarray of stringsAuto-assigned category tags
hashstringContent hash
created_atdatetimeCreation timestamp
updated_atdatetimeLast modification timestamp

Search results additionally include score (relevance metric).

Scoping Identifiers

Memories can be scoped to different levels:

ScopeParameterUse Case
Useruser_idPer-user memory isolation
Agentagent_idPer-agent memory partitioning
Applicationapp_idCross-agent app-level memory
Run/Sessionrun_idSession-scoped temporary memory

Critical: Combining user_id and agent_id in a single AND filter yields empty results. Entities are stored separately. Use OR logic or separate queries.

Processing Model

  • Memories are processed asynchronously (v3 default)
  • Add responses return queued ADD events only (v3 is ADD-only, no UPDATE/DELETE)
  • Poll status via GET /v1/event/{event_id}/

Filter System

Filters use nested JSON with a logical operator at the root:

{
    "AND": [
        {"user_id": "alice"},
        {"categories": {"contains": "finance"}},
        {"created_at": {"gte": "2024-01-01"}}
    ]
}

Root must be AND, OR, or NOT. Simple shorthand {"user_id": "alice"} also works.

Supported Operators

OperatorDescription
eqEqual to (default)
neNot equal to
inMatches any value in array
gt, gteGreater than / greater than or equal
lt, lteLess than / less than or equal
containsCase-sensitive containment
icontainsCase-insensitive containment
*Wildcard -- matches any non-null value

Filterable Fields

FieldValid Operators
user_id, agent_id, app_id, run_ideq, ne, in, *
created_at, updated_at, timestampgt, gte, lt, lte, eq, ne
categorieseq, ne, in, contains
metadataeq, ne, contains (top-level keys only)
keywordscontains, icontains
memory_idsin

Filter Constraints

  1. Entity scope partitioning: user_id AND agent_id in one AND block yields empty results.
  2. Metadata limitations: Only top-level keys. Only eq, contains, ne. No in or gt.
  3. Operator syntax: Use gte, lt, ne. SQL-style (>=, !=) rejected.
  4. Entity filter required for get-all: At least one of user_id, agent_id, app_id, or run_id.
  5. Wildcard excludes null: * matches only non-null values.
  6. Date format: ISO 8601 (YYYY-MM-DDTHH:MM:SSZ). Timezone-naive defaults to UTC.

Response Formats

Add Response (v3)

{
  "message": "Memory processing has been queued for background execution",
  "status": "PENDING",
  "event_id": "evt-uuid"
}

v3 is ADD-only. No UPDATE or DELETE events.

Search Response

{
  "results": [
    {
      "id": "ea925981-...",
      "memory": "Is a vegetarian and allergic to nuts.",
      "user_id": "user123",
      "categories": ["food", "health"],
      "score": 0.89,
      "created_at": "2024-07-26T10:29:36.630547-07:00"
    }
  ]
}

In v3, score is a combined multi-signal relevance score.

Get All Response (v3)

{
  "count": 123,
  "next": "https://api.mem0.ai/v3/memories/?page=2&page_size=50",
  "previous": null,
  "results": [...]
}

v3 returns paginated envelope. Use page and page_size query params.

Referenced from SKILL.md