apps/docs/add-memories/overview.mdx
Add any type of content to Supermemory - text, files, URLs, images, videos, and more. Everything is automatically processed into searchable memories that form part of your intelligent knowledge graph.
Before adding memories, you need to set up the Supermemory client:
npm install supermemory
pip install supermemory
import Supermemory from 'supermemory';
const client = new Supermemory({
apiKey: process.env.SUPERMEMORY_API_KEY!
});
from supermemory import Supermemory
import os
client = Supermemory(
api_key=os.environ.get("SUPERMEMORY_API_KEY")
)
// Add text content
const result = await client.add({
content: "Machine learning enables computers to learn from data",
containerTag: "ai-research",
metadata: { priority: "high" }
});
console.log(result);
// Output: { id: "abc123", status: "queued" }
# Add text content
result = client.add(
content="Machine learning enables computers to learn from data",
container_tags=["ai-research"],
metadata={"priority": "high"}
)
print(result)
# Output: {"id": "abc123", "status": "queued"}
curl -X POST "https://api.supermemory.ai/v3/documents" \
-H "Authorization: Bearer $SUPERMEMORY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "Machine learning enables computers to learn from data",
"containerTag": "ai-research",
"metadata": {"priority": "high"}
}'
# Response: {"id": "abc123", "status": "queued"}
Add content through three methods:
POST /v3/documents
Add text content, URLs, or any supported format.
<CodeGroup>await client.add({
content: "Your content here",
containerTag: "project"
});
client.add(
content="Your content here",
container_tags=["project"]
)
curl -X POST "https://api.supermemory.ai/v3/documents" \
-H "Authorization: Bearer $SUPERMEMORY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"content": "Your content here", "containerTag": "project"}'
POST /v3/documents/file
Upload files directly for processing.
<CodeGroup>await client.documents.uploadFile({
file: fileStream,
containerTag: "project"
});
client.documents.upload_file(
file=open('file.pdf', 'rb'),
container_tags='project'
)
curl -X POST "https://api.supermemory.ai/v3/documents/file" \
-H "Authorization: Bearer $SUPERMEMORY_API_KEY" \
-F "[email protected]" \
-F "containerTags=project"
PATCH /v3/documents/{id}
Update existing document content or metadata. Content changes trigger reindexing; metadata-only updates do not.
<CodeGroup>await client.documents.update("doc_id", {
content: "Updated content"
});
client.documents.update("doc_id", {
"content": "Updated content"
})
curl -X PATCH "https://api.supermemory.ai/v3/documents/doc_id" \
-H "Authorization: Bearer $SUPERMEMORY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"content": "Updated content"}'
<Note> Refer to the connectors guide to learn how you can connect Google Drive, Notion, and OneDrive and sync files in real-time. </Note>
{
"id": "D2Ar7Vo7ub83w3PRPZcaP1",
"status": "queued"
}
id: Unique document identifierstatus: Processing state (queued, processing, done)