Add Memory API | OpenMemory
API reference for adding memories to the OpenMemory Backend Server.
Add Memory API
[!NOTE] This reference is for the Backend Server API. If you are using Standalone Mode, use the JavaScript SDK or Python SDK directly.
Add new memories to OpenMemory with full control over content, metadata, and salience parameters.
Endpoint
POST /memory/add
Authentication
Authorization: Bearer your_api_key_here
Request Body
interface AddMemoryRequest {
content: string;
tags?: string[];
metadata?: Record<string, any>;
user_id?: string;
}
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
content | string | Yes | - | The memory content to store |
tags | string[] | No | [] | Tags for categorization |
metadata | object | No | {} | Additional metadata |
user_id | string | No | - | User ID for multi-user isolation |
Example
curl -X POST http://localhost:8080/memory/add \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your_api_key" \
-d '{
"content": "User prefers dark mode",
"tags": ["preferences", "ui"],
"metadata": {
"source": "settings_page"
}
}'
Response
{
"id": "mem_abc123",
"primary_sector": "semantic",
"sectors": ["semantic", "procedural"]
}