QUICK START
1. GET API KEY
Create an account and generate your API key from the dashboard
2. SAVE MEMORY
Send POST requests to save user data with your API key
3. SEARCH MEMORY
Query saved memories using semantic search with vector embeddings
4. READ MEMORY
Retrieve memory items with filtering, sorting, and pagination
AUTHENTICATION
All API requests require authentication using your API key in the Authorization header:
Authorization: Bearer str_your_api_key_here
TTL (TIME TO LIVE)
TTL allows automatic deletion of memory records after a specified number of days without activity. This helps control storage costs and ensures GDPR compliance.
How TTL Works:
ttl_days
: memory lifetime in days (1-365, default: 7)last_accessed_at
: timestamp of last memory accessexpires_at
: expiration time (automatically calculated)search-memory
and read-memory
operationsTTL Usage Examples:
Short-term Memory
Temporary notes, meetings
ttl_days: 1
User Preferences
Settings, preferences
ttl_days: 30-90
Critical Data
Important information
ttl_days: 365
SAVE MEMORY
/api/save-memory
Save user data to persistent memory. Each memory item is associated with a user_id that you provide.
Request Body:
{ "user_id": "string", // Required: Your user identifier "content": "string", // Required: The memory content "metadata": {}, // Optional: Additional data "tags": ["string"], // Optional: Tags for categorization "ttl_days": 7 // Optional: Days until expiration (1-365, default: 7)}
Response:
{ "success": true, "data": { "id": "uuid", "user_id": "string", "content": "string", "metadata": {}, "tags": ["string"], "token_count": 25, "ttl_days": 7, "expires_at": "2025-10-24T...", "created_at": "2025-10-17T..." }}
SEARCH MEMORY
/api/search-memory
Search through saved memories using semantic similarity. The system automatically generates embeddings for your query and finds the most relevant memories based on cosine similarity.
Request Body:
{ "user_id": "string", // Required: Your user identifier "query": "string", // Required: Search query "limit": 10, // Optional: Max results (default: 10) "similarity_threshold": 0.7, // Optional: Min similarity score (default: 0.7) "max_tokens": 1000, // Optional: Max total tokens in results (100-1,000,000) "tags": ["string"] // Optional: Filter by tags}
Response:
{ "success": true, "results": [ { "id": "uuid", "user_id": "string", "content": "string", "metadata": {}, "tags": ["string"], "token_count": 25, "created_at": "2025-10-17T...", "similarity_score": 0.85 } ], "query": "string", "total_results": 1}
ADVANCED EXAMPLES
SAVE MEMORY VARIATIONS
Minimal Save
curl -X POST https://api.strayl.cloud/api/save-memory \-H "Authorization: Bearer str_your_api_key_here" \-H "Content-Type: application/json" \-d '{
"user_id": "user123",
"content": "User likes coffee and works remotely",
"ttl_days": 7
}'
Save with Rich Metadata
curl -X POST https://api.strayl.cloud/api/save-memory \-H "Authorization: Bearer str_your_api_key_here" \-H "Content-Type: application/json" \-d '{
"user_id": "user123",
"content": "Customer prefers email communication and has premium subscription",
"metadata": {
"source": "customer_support",
"confidence": 0.95,
"priority": "high",
"category": "preferences",
"last_updated": "2025-01-15T10:30:00Z"
},
"tags": [
"customer",
"communication",
"premium",
"support"
],
"ttl_days": 30
}'
Save with Short TTL (1 day)
curl -X POST https://api.strayl.cloud/api/save-memory \-H "Authorization: Bearer str_your_api_key_here" \-H "Content-Type: application/json" \-d '{
"user_id": "user123",
"content": "Temporary meeting notes - expires in 1 day",
"metadata": {
"source": "meeting",
"type": "temporary"
},
"tags": [
"meeting",
"temporary"
],
"ttl_days": 1
}'
Save with Long TTL (365 days)
curl -X POST https://api.strayl.cloud/api/save-memory \-H "Authorization: Bearer str_your_api_key_here" \-H "Content-Type: application/json" \-d '{
"user_id": "user123",
"content": "Critical user preferences - keep for 1 year",
"metadata": {
"source": "user_profile",
"importance": "critical"
},
"tags": [
"preferences",
"critical",
"long_term"
],
"ttl_days": 365
}'
SEARCH MEMORY VARIATIONS
Minimal Search
curl -X POST https://api.strayl.cloud/api/search-memory \-H "Authorization: Bearer str_your_api_key_here" \-H "Content-Type: application/json" \-d '{
"user_id": "user123",
"query": "coffee preferences"
}'
Search with Token Limit
curl -X POST https://api.strayl.cloud/api/search-memory \-H "Authorization: Bearer str_your_api_key_here" \-H "Content-Type: application/json" \-d '{
"user_id": "user123",
"query": "customer support history",
"limit": 20,
"similarity_threshold": 0.5,
"max_tokens": 5000,
"tags": [
"support",
"customer"
]
}'
DELETE MEMORY VARIATIONS
Delete All Memory
curl -X POST https://api.strayl.cloud/api/delete-memory \-H "Authorization: Bearer str_your_api_key_here" \-H "Content-Type: application/json" \-d '{
"user_id": "user123",
"delete_type": "all",
"dry_run": false,
"confirm": true
}'
Delete by Content Pattern
curl -X POST https://api.strayl.cloud/api/delete-memory \-H "Authorization: Bearer str_your_api_key_here" \-H "Content-Type: application/json" \-d '{
"user_id": "user123",
"delete_type": "by_content",
"filters": {
"content_pattern": "test data"
},
"dry_run": true,
"confirm": true
}'
Delete by Date Range
curl -X POST https://api.strayl.cloud/api/delete-memory \-H "Authorization: Bearer str_your_api_key_here" \-H "Content-Type: application/json" \-d '{
"user_id": "user123",
"delete_type": "by_date",
"filters": {
"date_from": "2024-01-01T00:00:00Z",
"date_to": "2024-12-31T23:59:59Z"
},
"dry_run": true,
"confirm": true
}'
Delete by Specific IDs
curl -X POST https://api.strayl.cloud/api/delete-memory \-H "Authorization: Bearer str_your_api_key_here" \-H "Content-Type: application/json" \-d '{
"user_id": "user123",
"delete_type": "by_id",
"filters": {
"ids": [
"uuid1",
"uuid2",
"uuid3"
]
},
"dry_run": false,
"confirm": true
}'
READ MEMORY VARIATIONS
Minimal Read
curl -X POST https://api.strayl.cloud/api/read-memory \-H "Authorization: Bearer str_your_api_key_here" \-H "Content-Type: application/json" \-d '{
"user_id": "user123"
}'
Read with Pagination
curl -X POST https://api.strayl.cloud/api/read-memory \-H "Authorization: Bearer str_your_api_key_here" \-H "Content-Type: application/json" \-d '{
"user_id": "user123",
"limit": 50,
"offset": 100,
"sort_by": "token_count",
"sort_order": "desc",
"include_metadata": true,
"include_tags": true,
"include_token_count": true
}'
Read with Advanced Filters
curl -X POST https://api.strayl.cloud/api/read-memory \-H "Authorization: Bearer str_your_api_key_here" \-H "Content-Type: application/json" \-d '{
"user_id": "user123",
"limit": 25,
"offset": 0,
"sort_by": "updated_at",
"sort_order": "asc",
"tags": [
"customer",
"support"
],
"date_from": "2025-01-01T00:00:00Z",
"date_to": "2025-01-31T23:59:59Z",
"content_pattern": "subscription",
"include_metadata": false,
"include_tags": true,
"include_token_count": true
}'
CODE EXAMPLES
SAVE MEMORY
cURL
curl -X POST https://api.strayl.cloud/api/save-memory \-H "Authorization: Bearer str_your_api_key_here" \-H "Content-Type: application/json" \-d '{
"user_id": "user123",
"content": "User prefers dark mode and uses Python for development",
"metadata": {
"source": "user_preferences",
"confidence": 0.9
},
"tags": [
"preferences",
"ui",
"programming"
]
}'
SEARCH MEMORY
cURL
curl -X POST https://api.strayl.cloud/api/search-memory \-H "Authorization: Bearer str_your_api_key_here" \-H "Content-Type: application/json" \-d '{
"user_id": "user123",
"query": "user interface preferences",
"limit": 5,
"similarity_threshold": 0.6,
"max_tokens": 1000,
"tags": [
"preferences",
"ui"
]
}'
DELETE MEMORY
cURL
curl -X POST https://api.strayl.cloud/api/delete-memory \-H "Authorization: Bearer str_your_api_key_here" \-H "Content-Type: application/json" \-d '{
"user_id": "user123",
"delete_type": "by_tags",
"filters": {
"tags": [
"old",
"deprecated"
]
},
"dry_run": true,
"confirm": true
}'
COMPLETE EXAMPLES
JavaScript
// Complete JavaScript SDK Exampleclass StraylMemory { constructor(apiKey) { this.apiKey = apiKey; this.baseUrl = 'https://api.strayl.cloud/api'; } async request(endpoint, data) { const response = await fetch(`${this.baseUrl}${endpoint}`, { method: 'POST', headers: { 'Authorization': `Bearer ${this.apiKey}`, 'Content-Type': 'application/json' }, body: JSON.stringify(data) }); if (!response.ok) { const error = await response.json(); throw new Error(`API Error: ${error.error || response.statusText}`); } return await response.json(); } // Save memory with different options async saveMemory(userId, content, options = {}) { return await this.request('/save-memory', { user_id: userId, content: content, metadata: options.metadata || {}, tags: options.tags || [], ttl_days: options.ttl_days || 7 }); } // Search memory with advanced options async searchMemory(userId, query, options = {}) { return await this.request('/search-memory', { user_id: userId, query: query, limit: options.limit || 10, similarity_threshold: options.similarity_threshold || 0.7, max_tokens: options.max_tokens, tags: options.tags }); } // Read memory with pagination and filters async readMemory(userId, options = {}) { return await this.request('/read-memory', { user_id: userId, limit: options.limit || 10, offset: options.offset || 0, sort_by: options.sort_by || 'created_at', sort_order: options.sort_order || 'desc', tags: options.tags, date_from: options.date_from, date_to: options.date_to, content_pattern: options.content_pattern, include_metadata: options.include_metadata !== false, include_tags: options.include_tags !== false, include_token_count: options.include_token_count !== false }); } // Delete memory with different strategies async deleteMemory(userId, deleteType, filters = {}, options = {}) { return await this.request('/delete-memory', { user_id: userId, delete_type: deleteType, filters: filters, dry_run: options.dry_run || false, confirm: options.confirm || false }); }}// Usage Examplesconst memory = new StraylMemory('str_your_api_key_here');// Save different types of memory with TTLawait memory.saveMemory('user123', 'User prefers dark mode', { metadata: { source: 'ui_preferences', confidence: 0.9 }, tags: ['preferences', 'ui'], ttl_days: 30});await memory.saveMemory('user123', 'Customer has premium subscription', { metadata: { source: 'customer_support', priority: 'high', category: 'subscription' }, tags: ['customer', 'premium', 'subscription'], ttl_days: 90});// Save temporary data with short TTLawait memory.saveMemory('user123', 'Temporary meeting notes', { metadata: { source: 'meeting', type: 'temporary' }, tags: ['meeting', 'temporary'], ttl_days: 1});// Save critical data with long TTLawait memory.saveMemory('user123', 'Critical user preferences', { metadata: { source: 'user_profile', importance: 'critical' }, tags: ['preferences', 'critical'], ttl_days: 365});// Search with different strategiesconst results = await memory.searchMemory('user123', 'user preferences', { limit: 5, similarity_threshold: 0.6, max_tokens: 2000, tags: ['preferences']});// Read with paginationconst page1 = await memory.readMemory('user123', { limit: 20, offset: 0, sort_by: 'created_at', sort_order: 'desc'});// Delete with dry run firstconst dryRunResult = await memory.deleteMemory('user123', 'by_tags', { tags: ['old', 'deprecated']}, { dry_run: true });console.log('Would delete:', dryRunResult.deleted_count, 'items');// Then actually delete if confirmedif (dryRunResult.deleted_count > 0) { const deleteResult = await memory.deleteMemory('user123', 'by_tags', { tags: ['old', 'deprecated'] }, { confirm: true }); console.log('Deleted:', deleteResult.deleted_count, 'items');}
Python
import requestsimport jsonfrom typing import Dict, List, Optional, Anyfrom datetime import datetimeclass StraylMemory: def __init__(self, api_key: str): self.api_key = api_key self.base_url = "https://api.strayl.cloud/api" self.headers = { "Authorization": f"Bearer {api_key}", "Content-Type": "application/json" } def _request(self, endpoint: str, data: Dict[str, Any]) -> Dict[str, Any]: """Make API request with error handling""" response = requests.post( f"{self.base_url}{endpoint}", headers=self.headers, json=data ) if not response.ok: error_data = response.json() if response.content else {} raise Exception(f"API Error: {error_data.get('error', response.status_text)}") return response.json() def save_memory(self, user_id: str, content: str, metadata: Optional[Dict] = None, tags: Optional[List[str]] = None, ttl_days: int = 7) -> Dict[str, Any]: """Save memory with optional metadata, tags, and TTL""" return self._request('/save-memory', { 'user_id': user_id, 'content': content, 'metadata': metadata or {}, 'tags': tags or [], 'ttl_days': ttl_days }) def search_memory(self, user_id: str, query: str, limit: int = 10, similarity_threshold: float = 0.7, max_tokens: Optional[int] = None, tags: Optional[List[str]] = None) -> Dict[str, Any]: """Search memory with semantic similarity""" data = { 'user_id': user_id, 'query': query, 'limit': limit, 'similarity_threshold': similarity_threshold } if max_tokens: data['max_tokens'] = max_tokens if tags: data['tags'] = tags return self._request('/search-memory', data) def read_memory(self, user_id: str, limit: int = 10, offset: int = 0, sort_by: str = 'created_at', sort_order: str = 'desc', tags: Optional[List[str]] = None, date_from: Optional[str] = None, date_to: Optional[str] = None, content_pattern: Optional[str] = None, include_metadata: bool = True, include_tags: bool = True, include_token_count: bool = True) -> Dict[str, Any]: """Read memory with pagination and filters""" data = { 'user_id': user_id, 'limit': limit, 'offset': offset, 'sort_by': sort_by, 'sort_order': sort_order, 'include_metadata': include_metadata, 'include_tags': include_tags, 'include_token_count': include_token_count } if tags: data['tags'] = tags if date_from: data['date_from'] = date_from if date_to: data['date_to'] = date_to if content_pattern: data['content_pattern'] = content_pattern return self._request('/read-memory', data) def delete_memory(self, user_id: str, delete_type: str, filters: Optional[Dict] = None, dry_run: bool = False, confirm: bool = False) -> Dict[str, Any]: """Delete memory with different strategies""" data = { 'user_id': user_id, 'delete_type': delete_type, 'filters': filters or {}, 'dry_run': dry_run, 'confirm': confirm } return self._request('/delete-memory', data)# Usage Examplesmemory = StraylMemory("str_your_api_key_here")# Save different types of memory with TTLresult = memory.save_memory( user_id="user123", content="User prefers dark mode and uses Python for development", metadata={ "source": "user_preferences", "confidence": 0.9, "priority": "high" }, tags=["preferences", "ui", "programming"], ttl_days=30)print("Memory saved:", result)# Save customer data with medium TTLcustomer_data = memory.save_memory( user_id="customer456", content="Customer has premium subscription and prefers email support", metadata={ "source": "customer_support", "category": "subscription", "last_contact": "2025-01-15T10:30:00Z" }, tags=["customer", "premium", "support", "email"], ttl_days=90)# Save temporary data with short TTLtemp_data = memory.save_memory( user_id="user123", content="Temporary meeting notes - expires in 1 day", metadata={ "source": "meeting", "type": "temporary" }, tags=["meeting", "temporary"], ttl_days=1)# Save critical data with long TTLcritical_data = memory.save_memory( user_id="user123", content="Critical user preferences - keep for 1 year", metadata={ "source": "user_profile", "importance": "critical" }, tags=["preferences", "critical", "long_term"], ttl_days=365)# Search with different strategiessearch_results = memory.search_memory( user_id="user123", query="user interface preferences", limit=5, similarity_threshold=0.6, max_tokens=2000, tags=["preferences", "ui"])print(f"Found {len(search_results['results'])} results")# Read with paginationpage1 = memory.read_memory( user_id="user123", limit=20, offset=0, sort_by="created_at", sort_order="desc")print(f"Page 1: {len(page1['data']['items'])} items")# Read with filtersfiltered_results = memory.read_memory( user_id="customer456", limit=10, tags=["customer", "premium"], date_from="2025-01-01T00:00:00Z", content_pattern="subscription", include_metadata=True)# Delete with dry run firstdry_run_result = memory.delete_memory( user_id="user123", delete_type="by_tags", filters={"tags": ["old", "deprecated"]}, dry_run=True)print(f"Would delete: {dry_run_result['deleted_count']} items")# Actually delete if confirmedif dry_run_result['deleted_count'] > 0: delete_result = memory.delete_memory( user_id="user123", delete_type="by_tags", filters={"tags": ["old", "deprecated"]}, confirm=True ) print(f"Deleted: {delete_result['deleted_count']} items")# Delete by date rangeold_data_deletion = memory.delete_memory( user_id="user123", delete_type="by_date", filters={ "date_from": "2024-01-01T00:00:00Z", "date_to": "2024-12-31T23:59:59Z" }, dry_run=True, confirm=True)# Delete specific items by IDspecific_deletion = memory.delete_memory( user_id="user123", delete_type="by_id", filters={"ids": ["uuid1", "uuid2", "uuid3"]}, confirm=True)
READ MEMORY
READ MEMORY
cURL
curl -X POST https://api.strayl.cloud/api/read-memory \-H "Authorization: Bearer str_your_api_key_here" \-H "Content-Type: application/json" \-d 'curl -X POST https://api.strayl.cloud/api/read-memory \
-H "Authorization: Bearer str_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"user_id": "user123",
"limit": 10,
"offset": 0,
"sort_by": "created_at",
"sort_order": "desc",
"tags": ["preferences"],
"date_from": "2025-01-01T00:00:00Z",
"content_pattern": "dark mode"
}''
JavaScript
// Read memory with pagination and filtersconst readResponse = await fetch('https://api.strayl.cloud/api/read-memory', { method: 'POST', headers: { 'Authorization': 'Bearer str_your_api_key_here', 'Content-Type': 'application/json' }, body: JSON.stringify({ user_id: 'user123', limit: 10, offset: 0, sort_by: 'created_at', sort_order: 'desc', tags: ['preferences'], date_from: '2025-01-01T00:00:00Z', content_pattern: 'dark mode' })});const readData = await readResponse.json();console.log('Memory items:', readData);
Python
# Read memory with pagination and filtersread_url = "https://api.strayl.cloud/api/read-memory"read_data = { "user_id": "user123", "limit": 10, "offset": 0, "sort_by": "created_at", "sort_order": "desc", "tags": ["preferences"], "date_from": "2025-01-01T00:00:00Z", "content_pattern": "dark mode"}read_response = requests.post(read_url, headers=headers, json=read_data)read_result = read_response.json()print("Memory items:", read_result)
DELETE MEMORY
/api/delete-memory
Delete memory items with flexible filtering options. Supports dry-run mode for safe testing.
Request Body:
{ "user_id": "string", // Required: Your user identifier "delete_type": "string", // Required: "all", "by_tags", "by_content", "by_date", "by_id" "filters": { // Optional: Filters for selective deletion "tags": ["string"], // Delete items with specific tags "content_pattern": "string", // Delete items containing pattern "date_from": "string", // Delete items after date (ISO) "date_to": "string", // Delete items before date (ISO) "ids": ["string"] // Delete specific items by ID }, "dry_run": false, // Optional: Test mode - show what would be deleted "confirm": false // Required: Confirmation for mass deletion}
Delete Types:
all
- Delete all memory items for userby_tags
- Delete items with specific tagsby_content
- Delete items containing text patternby_date
- Delete items within date rangeby_id
- Delete specific items by IDResponse Body:
{ "success": true, "deleted_count": 3, "deleted_items": [ { "id": "uuid", "content": "string", "tags": ["string"], "created_at": "2025-10-17T..." } ], "dry_run": false, "message": "Successfully deleted 3 memory items"}
SUMMARIZE MEMORY
/api/summarize-memory
Generate an AI-powered summary of all memory items for a user. Uses Google Gemini 2.0 Flash Lite via OpenRouter. Results are cached automatically - subsequent requests for unchanged memory return the cached summary at no cost.
Smart Caching: Summaries are automatically cached. If memory hasn't changed since the last summarization, you'll get the cached result instantly with no API cost. The cache invalidates when memory is added, updated, or deleted.
Request Body:
{ "user_id": "string" // Required: Your user identifier}
Response Body:
{ "success": true, "data": { "summary": "string", // AI-generated summary of user memory "user_id": "string", "total_memory_items": 15, // Number of items included in summary "is_cached": false, // Whether this was served from cache "model": "google/gemini-2.0-flash-lite" }, "usage": { // Only present when is_cached = false "prompt_tokens": 1234, "completion_tokens": 567, "total_tokens": 1801, "cost_usd": 0.000123 // Actual cost from OpenRouter }}
Example:
$curl -X POST https://api.strayl.cloud/api/summarize-memory \
-H "Authorization: Bearer str_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"user_id": "user123"
}'
Example Response (First Time):
{ "success": true, "data": { "summary": "The user is a software developer who prefers dark mode interfaces and works primarily with Python. They are interested in machine learning and data science, particularly in natural language processing. The user works remotely and values efficient communication tools. They have a premium subscription and prefer email communication for support matters.", "user_id": "user123", "total_memory_items": 15, "is_cached": false, "model": "google/gemini-2.0-flash-lite" }, "usage": { "prompt_tokens": 1234, "completion_tokens": 89, "total_tokens": 1323, "cost_usd": 0.000096 }}
Example Response (Cached):
{ "success": true, "data": { "summary": "The user is a software developer who prefers dark mode interfaces...", "user_id": "user123", "total_memory_items": 15, "is_cached": true, "model": "google/gemini-2.0-flash-lite" }}
Key Features:
- • Automatic Caching: No cost for repeated requests on unchanged memory
- • Hierarchical Batching: Handles unlimited memory size via intelligent batching (up to 1M tokens)
- • Cost Tracking: Detailed usage statistics available in your dashboard
- • Smart Invalidation: Cache updates automatically when memory changes
- • Fast & Efficient: Uses Google Gemini 2.0 Flash Lite for optimal speed and cost
- • Transparent Pricing: Actual OpenRouter costs returned in response
Cost Information:
Summarization uses OpenRouter API with Google Gemini 2.0 Flash Lite. Costs vary based on the amount of memory being summarized. Track your usage and costs in the Usage Dashboard. Cached responses are free.
Hierarchical Summarization:
For large memory datasets (>500K tokens), the system automatically uses hierarchical batching. Memory is split into 100K token batches, each batch is summarized separately, then all batch summaries are combined into a final comprehensive summary. This ensures ALL memory items are included regardless of total size.
READ MEMORY
/api/read-memory
Retrieve memory items with flexible filtering, sorting, and pagination. Supports large datasets without hard limits.
Request Body:
{ "user_id": "string", // Required: Your user identifier "limit": 10, // Optional: Number of items to return (default: 10) "offset": 0, // Optional: Number of items to skip (default: 0) "sort_by": "created_at", // Optional: "created_at", "updated_at", "token_count" "sort_order": "desc", // Optional: "asc" or "desc" (default: "desc") "tags": ["string"], // Optional: Filter by specific tags "date_from": "string", // Optional: Filter items after date (ISO format) "date_to": "string", // Optional: Filter items before date (ISO format) "content_pattern": "string", // Optional: Filter by content containing pattern "include_metadata": true, // Optional: Include metadata in response "include_tags": true, // Optional: Include tags in response "include_token_count": true // Optional: Include token count in response}
Response Body:
{ "success": true, "data": { "items": [ { "id": "uuid", "user_id": "string", "content": "string", "metadata": {}, "tags": ["string"], "token_count": 42, "created_at": "2025-10-17T...", "updated_at": "2025-10-17T..." } ], "pagination": { "total": 150, "limit": 10, "offset": 0, "has_more": true }, "filters_applied": { "tags": ["preferences"], "date_range": { "from": "2025-01-01T00:00:00Z", "to": "2025-12-31T23:59:59Z" }, "content_pattern": "dark mode" } }, "query_time_ms": 45}
Features:
Flexible Filtering
- Filter by tags, date range, or content patternsMultiple Sorting
- Sort by creation date, update date, or token countPagination
- Handle large datasets with offset/limit paginationNo Hard Limits
- Retrieve millions of records without restrictionsPerformance
- Optimized queries with response time trackingRATE LIMITS & CONSTRAINTS
API Limits
Request Limits
- •
max_tokens
: 100 - 1,000,000 tokens - •
limit
: 1 - 100 items per request - •
similarity_threshold
: 0.0 - 1.0 - •
offset
: 0 - 10,000,000 - •
content
: Max 1MB per item - •
ttl_days
: 1 - 365 days (default: 7)
Performance Limits
- •
read-memory
: No hard limits on dataset size - •
search-memory
: Optimized for millions of records - •
delete-memory
: Batch operations supported - •
save-memory
: Real-time embedding generation - • Response time: < 500ms for most operations
Data Constraints
Required Fields
- •
user_id
: String identifier for your user - •
content
: The memory content to save - •
query
: Search query for search-memory - •
delete_type
: Type of deletion for delete-memory
Optional Fields
- •
metadata
: JSON object for additional data - •
tags
: Array of strings for categorization - •
ttl_days
: Number of days until expiration (1-365) - •
filters
: Object with filter criteria - •
dry_run
: Boolean for testing operations
Best Practices
Performance Optimization
- • Use
max_tokens
to control LLM context size - • Implement pagination for large datasets with
offset
andlimit
- • Use
tags
for efficient filtering - • Set appropriate
similarity_threshold
values
Data Management
- • Always use
dry_run: true
before mass deletions - • Use
confirm: true
for destructive operations - • Implement proper error handling for API responses
- • Monitor token usage to control LLM costs
- • Use appropriate
ttl_days
values for different data types - • Set short TTL for temporary data (1-7 days)
- • Set medium TTL for user preferences (30-90 days)
- • Set long TTL for critical data (365 days)
Security Considerations
- • Keep your API key secure and never expose it in client-side code
- • Use HTTPS for all API requests
- • Implement proper user_id validation in your application
- • Regularly rotate API keys for enhanced security
ERROR HANDLING
401 - Unauthorized
Invalid or missing API key
{ "error": "Invalid API key", "reason": "Key not found or expired"}
400 - Bad Request
Missing required fields
{ "error": "Missing required fields: user_id, content"}
Need help? Contact us at alemzhan@strayl.dev
© 2025 Strayl. All rights reserved.