REST API / n8n
External IntegrationIntegrate MemoAir with any platform using our REST API. Perfect for n8n workflows, custom chatbots, and any application that can make HTTP requests.
Base URL
1https://backend.memoair.spaceAuthentication
All requests require authentication via HTTP headers:
| Header | Required | Description |
|---|---|---|
| X-API-Key | Required | Your project API key from the dashboard |
| X-User-Id | Required | The end-user ID for memory isolation |
| X-Agent-Name | Optional | Agent name for dashboard visibility (e.g., "my-n8n-chatbot") |
| Content-Type | Required | Must be application/json |
Tip: Use X-Agent-Name to see your integration's activity in the Agents dashboard.
Search MemoriesPOST /v1/ext/memory/searchSearch your memory bank for relevant information.
Parameters
querystringRequiredThe search query to find relevant memories.
limitnumberOptionalDefault: 10Maximum number of results to return.
Example Request
1curl -X POST "https://backend.memoair.space/v1/ext/memory/search" \2 -H "Content-Type: application/json" \3 -H "X-API-Key: your-api-key" \4 -H "X-User-Id: user-123" \5 -H "X-Agent-Name: my-n8n-chatbot" \6 -d '{7 "query": "What are the user preferences?",8 "limit": 59 }'Example Response
1{2 "success": true,3 "results": [4 {5 "content": "User prefers TypeScript over JavaScript",6 "score": 0.92,7 "category": "preference",8 "source": "mcp-agent"9 },10 {11 "content": "User works on React projects",12 "score": 0.85,13 "category": "fact",14 "source": "n8n-chatbot"15 }16 ]17}Save MemoryPOST /v1/ext/memory/saveSave new information to the user's memory.
Parameters
contentstringRequiredThe content to save to memory.
sourceIdstringOptionalUnique identifier for this conversation/session. Used to consolidate multiple messages.
sourceTitlestringOptionalDisplay name for this memory source (e.g., "my-n8n-chatbot").
Example Request
1curl -X POST "https://backend.memoair.space/v1/ext/memory/save" \2 -H "Content-Type: application/json" \3 -H "X-API-Key: your-api-key" \4 -H "X-User-Id: user-123" \5 -H "X-Agent-Name: my-n8n-chatbot" \6 -d '{7 "content": "User: Hello!\nAssistant: Hi there! How can I help?",8 "sourceId": "conversation-abc123",9 "sourceTitle": "my-n8n-chatbot"10 }'Example Response
1{2 "success": true,3 "itemId": "f13eb412-5b80-4f94-ba54-d370ee034fee"4}Note: Using the same sourceId will append content to the existing memory item, consolidating the conversation.
n8n Integration Guide
Build a memory-enabled chatbot in n8n using MemoAir:
Recommended Flow
Before your AI agent processes the user input, search for relevant context:
- Method:
POST - URL:
/v1/ext/memory/search - Body: User's message as the query
After the AI responds, save the conversation exchange:
- Method:
POST - URL:
/v1/ext/memory/save - Body: Format as "User: ... Assistant: ..."
n8n HTTP Request Configuration
In each HTTP Request node, configure:
1Method: POST2URL: https://backend.memoair.space/v1/ext/memory/search34Headers (Using Fields):5 - X-API-Key: {{ $credentials.memoairApiKey }}6 - X-User-Id: {{ $json.userId || "default-user" }}7 - X-Agent-Name: my-n8n-chatbot8 - Content-Type: application/json910Body (Using Fields):11 - query: {{ $json.chatInput }}12 - limit: 5Important: In n8n, use "Specify Body" → "Using Fields Below" instead of raw JSON to avoid escaping issues with special characters in the content.
How It Works
1. Working Memory (Hippocampus)
Saved memories first go to "Working Memory" - a temporary staging area where they're processed and extracted.
2. Memory Extraction
MemoAir automatically extracts facts, preferences, actions, and Q&A from the conversation content.
3. Auto-Promotion to Cortex
Based on your project settings, extracted memories are automatically saved to the long-term memory graph (Cortex).
4. Searchable via Graph
Memories are indexed in the knowledge graph and can be searched semantically across all your agents and integrations.
Multi-User Support
Use a single API key for multiple end-users by varying the X-User-Id header:
1# User A's memories2curl -X POST "https://backend.memoair.space/v1/ext/memory/search" \3 -H "X-API-Key: project-key" \4 -H "X-User-Id: user-alice" \5 -d '{"query": "preferences"}'67# User B's memories (isolated)8curl -X POST "https://backend.memoair.space/v1/ext/memory/search" \9 -H "X-API-Key: project-key" \10 -H "X-User-Id: user-bob" \11 -d '{"query": "preferences"}'Each user ID has isolated memory storage while sharing the same project configuration.
Error Handling
| Status | Meaning | Solution |
|---|---|---|
| 400 | Bad Request | Check required fields (query, content) |
| 401 | Unauthorized | Verify X-API-Key and X-User-Id headers |
| 405 | Method Not Allowed | Use POST method, not GET |
| 500 | Server Error | Check request body is valid JSON |