Understanding the Mental Model
Before diving into the API, it’s important to understand how Supermemory processes your content:Documents vs Memories
- Documents: Anything you put into Supermemory (files, URLs, text) is considered a document
- Memories: Documents are automatically chunked into smaller, searchable pieces called memories
Content Sources
Supermemory accepts content through three main methods:- Direct API: Upload files or send content via API endpoints
- Connectors: Automated integrations with platforms like Google Drive, Notion, and OneDrive (learn more about connectors)
- URL Processing: Automatic extraction from web pages, videos, and social media
Overview
The ingestion system consists of several key components:- Multiple Input Methods: JSON content, file uploads, and URL processing
- Asynchronous Processing: Background workflows handle content extraction and chunking
- Auto Content Detection: Automatically identifies and processes different content types
- Space Organization: Container tags group related memories for better context inference
- Status Tracking: Real-time status updates throughout the processing pipeline
How It Works
1
Submit Document
Send your content (text, file, or URL) to create a new document
2
Validation
API validates the request and checks rate limits/quotas
3
Document Storage
Your content is stored as a document and queued for processing
4
Content Extraction
Specialized extractors process the document based on its type
5
Memory Creation
Document is intelligently chunked into multiple searchable memories
6
Embedding & Indexing
Memories are converted to vector embeddings and made searchable
Ingestion Endpoints
Add Document - JSON Content
The primary endpoint for adding content that will be processed into documents. Endpoint:POST /v3/documents
Despite the endpoint name, you’re creating a document that Supermemory will automatically chunk into searchable memories.
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
content | string | Yes | The content to process into a document. Can be text, URL, or other supported formats |
containerTag | string | No | Recommended: Single tag to group related memories in a space. Defaults to "sm_project_default" |
containerTags | string[] | No | Legacy array format. Use containerTag instead for better performance |
metadata | object | No | Additional key-value metadata (strings, numbers, booleans only) |
customId | string | No | Your own identifier for this document (max 255 characters) |
raw | string | No | Raw content to store alongside processed content |
Response
When you successfully create a document, you’ll get back a simple confirmation with the document ID and its initial processing status:id
: Your document’s unique identifier - save this to track processing or reference laterstatus
: Current processing state."queued"
means it’s waiting to be processed into memories
The document starts processing immediately in the background. Within seconds to minutes (depending on content size), it will be chunked into searchable memories.
File Upload: Drop and Process
Got a PDF, image, or video? Upload it directly and let Supermemory extract the valuable content automatically. Endpoint:POST /v3/documents/file
What makes this powerful: Instead of manually copying text from PDFs or transcribing videos, just upload the file. Supermemory handles OCR for images, transcription for videos, and intelligent text extraction for documents.
Supported File Types
- PDF: Extracted with OCR support for scanned documents
- Google Docs: Via Google Drive API integration
- Google Sheets: Spreadsheet content extraction
- Google Slides: Presentation content extraction
- Notion Pages: Rich content with block structure preservation
- OneDrive Documents: Microsoft Office documents
Content Types & Processing
Automatic Detection
Supermemory automatically detects content types based on:- URL patterns: Domain and path analysis for special services
- MIME types: File type detection from headers/metadata
- Content analysis: Structure and format inspection
- File extensions: Fallback identification method
Processing Pipeline
Each content type follows a specialized processing pipeline:Text Content
Text Content
Content is cleaned, normalized, and chunked for optimal retrieval:
- Queued: Memory enters the processing queue
- Extracting: Text normalization and cleaning
- Chunking: Intelligent splitting based on content structure
- Embedding: Convert to vector representations for search
- Indexing: Add to searchable index
- Done: Metadata extraction completed
Web Content
Web Content
Web pages undergo sophisticated content extraction:
- Queued: URL queued for processing
- Extracting: Fetch page content with proper headers, remove navigation and boilerplate, extract title, description, etc.
- Chunking: Content split for optimal retrieval
- Embedding: Vector representation generation
- Indexing: Add to search index
- Done: Processing complete with
type: 'webpage'
File Processing
File Processing
Files are processed through specialized extractors:
- Queued: File queued for processing
- Content Extraction: Type detection and format-specific processing.
- OCR/Transcription: For images and media files
- Chunking: Content broken down into searchable segments
- Embedding: Vector representation creation
- Indexing: Add to search index
- Done: Processing completed
Error Handling
Common Errors
Scroll right to see more.- Missing or invalid API key
- Expired authentication token
- Incorrect authorization header format
Best Practices
Container Tags: Optimize for Performance
Use single container tags for better query performance. Multiple tags are supported but increase latency.- Memories in the same space can reference each other efficiently
- Search queries don’t need to traverse multiple spaces
- Connection inference is faster within a single space
Custom IDs: Deduplication and Updates
Custom IDs prevent duplicates and enable document updates. Two update methods available. Method 1: POST with customId (Upsert)- Old memories are deleted
- New memories created from updated content
- Same document ID maintained
Rate Limits & Quotas
Token UsageFeature | Free | Starter | Growth |
---|---|---|---|
Memory Tokens/month | 100,000 | 1,000,000 | 10,000,000 |
Search Queries/month | 1,000 | 10,000 | 100,000 |
Batch Upload of Documents
Process large volumes efficiently with rate limiting and error recovery.Implementation Strategy
Best Practices for Batch Operations
Performance Optimization
Performance Optimization
- Batch Size: 3-5 documents at once
- Delays: 2-3 seconds between batches prevents rate limiting
- Promise.allSettled(): Handles mixed success/failure results
- Progress Tracking: Monitor long-running operations
Error Handling
Error Handling
- Specific Error Types: Handle
BadRequestError
,RateLimitError
,AuthenticationError
differently - No Retry Logic: Don’t retry validation or auth errors
- Rate Limit Handling: Longer backoff delays for rate limit errors
- Logging: Record failures for review/retry
Memory Management
Memory Management
- Streaming: Process large files in chunks
- Cleanup: Clear processed batches from memory
- Progress Persistence: Resume interrupted migrations
Ready to start ingesting? Get an API key now!