docs/integrations/n8n.mdx
Your n8n workflows start from zero on every run. The @mem0/n8n-nodes-mem0 community node fixes that: store durable facts as memories, recall them in any later run, and hand the node to an n8n AI Agent as a tool so it can remember and recall on its own.
A two-node workflow that writes a memory and reads it back:
Manual Trigger → Mem0 (Add) → Mem0 (Search)
`I am vegetarian and I never eat mushrooms.`
The node is marked usableAsTool, so an n8n AI Agent (Tools Agent) can call it without any wiring on your side:
Chat Trigger → AI Agent ──tool──▶ Mem0 (Search)
──tool──▶ Mem0 (Add)
Attach one Mem0 node set to Search and one set to Add. The agent searches memory before answering and writes back durable facts after a meaningful exchange. Keep User ID the same on both.
The node wraps the hosted Mem0 REST API and supports six operations on the Memory resource:
| Operation | What it does | Endpoint |
|---|---|---|
| Add | Extract and store memories from messages | POST /v3/memories/add/ |
| Search | Semantic search over stored memories | POST /v3/memories/search/ |
| Get Many | List stored memories (one page, or Return All) | POST /v3/memories/ |
| Get | Fetch a single memory by ID | GET /v1/memories/{id}/ |
| Update | Change a memory's text or metadata | PUT /v1/memories/{id}/ |
| Delete | Delete a single memory by ID | DELETE /v1/memories/{id}/ |
Extracts and stores memories from one or more messages. Supply at least one entity id (User ID, or Agent ID / App ID / Run ID under Additional Fields); the node checks this before calling the API.
Additional Fields:
| Field | Purpose |
|---|---|
| Agent ID | Scopes the memory to an agent |
| App ID | Scopes the memory to an app or project |
| Run ID | Scopes the memory to a single session or run |
| Metadata (JSON) | Arbitrary JSON attached to each extracted memory |
| Infer | On by default. Turn off to store messages verbatim instead of running LLM extraction |
| Custom Instructions | Free-text guidance steering what the extractor keeps or ignores, for this call |
| Custom Categories | JSON array of {category: description} objects, replacing the project-level catalog for this call |
| Includes | Only extract memories matching this description |
| Excludes | Skip memories matching this description |
Includes and Excludes narrow what extraction keeps. Sending "I am vegetarian and I never eat mushrooms. I drive a blue Toyota Corolla and my parking spot is B12" stores three memories by default; with Includes: "only record food and diet preferences" it stores just the dietary one.
Semantic search over stored memories. Takes a Query, at least one entity id, and an optional Limit.
Lists stored memories for the entity ids you supply. Turn on Return All to page through everything automatically, or leave it off to fetch a single Page. Page Size applies either way.
Operate on one memory by Memory ID. Update accepts new Text and/or Metadata (JSON).
Both operations take User ID, Agent ID, App ID, and Run ID. At least one is required, since the API rejects a query with no entity scope, and the node fails with a clear message before making the call if all four are empty.
Supply several and they combine with OR, so the result is the union of those scopes:
{ "OR": [{ "user_id": "alice" }, { "agent_id": "support-bot" }] }
The User ID is a stable string you pick to identify whose memories these are. It is not looked up in the dashboard, so any consistent value works: your app's internal user ID, an email, or a UUID. Use the same value across Add, Search, and Get Many or recall returns nothing.
401 Unauthorized: the API key is wrong or was revoked. Regenerate it in the <a href="https://app.mem0.ai/dashboard/api-keys?utm_source=oss&utm_medium=integration-n8n" rel="nofollow">API Keys dashboard</a> and update the credential.