Prerequisites
Before searching memories, you need to set up the Supermemory client:- Install the SDK for your language
- Get your API key from Supermemory Console
- Initialize the client with your API key
Search Endpoints Overview
Documents Search - Fast, Advanced RAG
POST /v3/searchFull-featured search with extensive control over ranking, filtering, thresholds, and result structure. Searches through and returns relevant documents. More flexibility.
Memories Search
POST /v4/searchMinimal-latency search optimized for chatbots and conversational AI. Searches through and returns memories. Simple parameters, fast responses, easy to use.
Documents vs Memories Search: What’s the Difference?
The key difference between/v3/search and /v4/search is documents vs memories. /v3/search searches through the documents and returns matching chunks, whereas /v4/search searches through user’s memories, preferences and history.
- Documents: Refer to the data you ingest like text, pdfs, videos, images, etc. They are sources of ground truth.
- Memories: They are automatically extracted from your documents by Supermemory. Smaller information chunks inferred from documents and related to each other.
Documents Search (/v3/search)
High quality documents search - extensive parameters for fine-tuning search behavior:
- Use cases: Use this endpoint for use cases where “literal” document search is required.
- Looking through legal/finance documents
- Searching through items in google drive
- Chat with documentation
- With this endpoint, you get Full Control over
- Thresholds,
- Filtering
- Reranking
- Query rewriting
- TypeScript
- Python
- cURL
Sample Response
/v3/search endpoint returns the most relevant documents and chunks from those documents. Head over to the response schema page to understand more about the response structure.
Memories Search (/v4/search)
Search through user memories:
- Use cases: Use this endpoint for use cases where understanding user context / preferences / memories is more important than literal document search.
- Personalized chatbots (AI Companions)
- Auto selecting based on what the user wants
- Setting the tone of the conversation
This endpoint works best for conversational AI use cases like chatbots.
- TypeScript
- Python
- cURL
Sample Response
/v4/search endpoint searches through and returns memories.
Direct Document Retrieval
If you don’t need semantic search and just want to retrieve a specific document you’ve uploaded by its ID, use the GET document endpoint:GET /v3/documents/{id}
This is useful when:
- You know the exact document ID
- You want to retrieve the full document content and metadata
- You need to check processing status or document details
This endpoint returns the complete document with all fields including content, metadata, containerTags, summary, and processing status. For more details, see the API reference.
Search Flow Architecture
Document Search (/v3/search) Flow
Memory Search (/v4/search) Flow
Key Concepts You Need to Understand
1. Thresholds (Sensitivity Control)
Thresholds control result quality vs quantity:- 0.0 = Least sensitive (more results, lower quality)
- 1.0 = Most sensitive (fewer results, higher quality)
2. Chunk Context vs Exact Matching
By default, Supermemory returns chunks with context (surrounding text):3. Query Rewriting & Reranking
Query Rewriting (+400ms latency):- Expands your query to find more relevant results
- “ML” becomes “machine learning artificial intelligence”
- Useful for abbreviations and domain-specific terms
- Re-scores results using a different algorithm
- More accurate but slower
- Recommended for critical searches
4. Container Tags vs Metadata Filters
Two different filtering mechanisms: When to use container tags:- The user understanding graph is built on top of container tags. The graph is formed on top of container tags.
- Container tags are used for organizational grouping and exact matching.
- They are useful for categorizing content and ensuring precise results. When to use metadata filters:
- When you need flexible conditions beyond exact matches.
- Useful for filtering by attributes like date, author, or category.