Memory Management API
The Memory Management API provides comprehensive operations for creating, retrieving, updating, and deleting memories in the Hystersis system. All memory operations include automatic processing with LLM-based fact extraction, entity linking, and compression.Authentication
All memory endpoints require authentication with API key:Rate Limits
Basic Operations
Create Memory
Create a new memory with automatic LLM processing. Endpoint:POST /memories
Request Body:
content(string, required): The memory content to storeuser_id(string, optional): User identifier for personalizationcategory(string, optional): Memory category for organizationmetadata(object, optional): Additional metadatatype(string, optional): Memory type (preference, fact, conversation, etc.)expire_at(string, optional): ISO 8601 timestamp for expiration
List Memories
Retrieve memories with optional filtering and pagination. Endpoint:GET /memories
Query Parameters:
user_id(string): Filter by user IDcategory(string): Filter by categorytype(string): Filter by memory typecreated_after(string): Filter memories created after timestampcreated_before(string): Filter memories created before timestamplimit(integer, default: 20, max: 100): Number of results per pageoffset(integer, default: 0): Offset for paginationsort(string, default: “created_at desc”): Sort field and direction
Get Memory
Retrieve a specific memory by ID. Endpoint:GET /memories/{id}
Response:
Update Memory
Update an existing memory’s content and metadata. Endpoint:PUT /memories/{id}
Request Body:
Delete Memory
Permanently delete a memory. Endpoint:DELETE /memories/{id}
Response:
Advanced Memory Operations
Process Memory
Process memory with specific options for extraction and compression. Endpoint:POST /memories/process
Request Body:
content(string, required): Memory content to processoptions(object): Processing optionsextract_facts(boolean): Extract facts from contentextract_entities(boolean): Extract and link entitiescompress(boolean): Apply compressioncompression_mode(string): “balanced”, “aggressive”, “conservative”skip_duplicates(boolean): Skip duplicate content detection
Infer Memory Content
Use LLM to infer additional content and context from existing memories. Endpoint:POST /memories/infer
Request Body:
memory_id(string, required): Memory ID to infer fromprompt(string, required): Inference promptcontext_limit(integer): Maximum context tokens
Batch Create Memories
Create multiple memories in a single request. Endpoint:POST /memories/batch
Request Body:
Batch Update Memories
Update multiple memories in a single request. Endpoint:PUT /memories/batch-update
Request Body:
Batch Delete Memories
Delete multiple memories by IDs or filters. Endpoint:DELETE /memories/batch-delete
Request Body (by IDs):
Bulk Delete by Filters
Delete memories matching complex filter criteria. Endpoint:DELETE /memories/bulk-delete
Request Body:
Get Memory Statistics
Retrieve comprehensive statistics about memories. Endpoint:GET /memories/stats
Response:
Memory Versioning
Get Memory History
Retrieve version history of a memory. Endpoint:GET /memories/{id}/history
Response:
Get Memory Versions
List all available versions of a memory. Endpoint:GET /memories/{id}/versions
Restore Memory Version
Restore a memory to a previous version. Endpoint:POST /memories/{id}/restore
Request Body:
Set Memory Expiration
Set or update expiration time for a memory. Endpoint:POST /memories/{id}/expire
Request Body:
Memory Relationships
Link Memory to Entity
Create a relationship between memory and entity. Endpoint:POST /memories/{id}/link/{entityID}
Request Body:
Get Memory Entities
Retrieve entities associated with a memory. Endpoint:GET /memories/{id}/entities
Memory Feedback
Add Memory Feedback
Provide feedback on memory quality and relevance. Endpoint:POST /memories/{id}/feedback
Request Body:
Error Handling
Common Error Responses
Error Codes
Best Practices
Memory Content Guidelines
- Be Specific: Use precise language rather than vague statements
- Include Context: Add relevant metadata for better recall
- Use Categories: Organize memories by category for better search
- Set Expiration: Use expiration for time-sensitive information
- Avoid PII: Remove personally identifiable information
Performance Optimization
- Batch Operations: Use batch endpoints for multiple operations
- Pagination: Use proper pagination for large result sets
- Filtering: Use filters to reduce data transfer
- Compression: Enable compression for large memories
- Caching: Cache frequently accessed memories locally
Security Considerations
- API Key Management: Rotate API keys regularly
- Access Control: Implement proper RBAC for memory access
- Data Encryption: Ensure sensitive memories are encrypted
- Audit Logging: Enable audit logging for all memory operations
- Rate Limiting: Implement appropriate rate limiting