Getting Started
Get up and running with the Memory Scope API in minutes. This guide will walk you through the basics of storing, reading, and managing user memories.
Prerequisites
Before you begin, make sure you have the following:
- Python 3.8+ or Node.js 18+
- An API key (sign up to get one)
- Basic understanding of REST APIs
1
Create an API Key
Sign up for an account and create your first API key from the developer console.
# Step 1: Sign up for an account
# Sign up is currently in closed beta. Visit /signup for more information, or /login if you already have an account.
# Step 2: Navigate to the Developer Console
# After signing in, go to /portal to access the console
# Step 3: Create your API key
# 1. Click "Create API Key" button
# 2. Enter a name for your key (e.g., "Production Key")
# 3. Click "Create Key"
# 4. IMPORTANT: Copy the key immediately - you won't see it again!
# Your API key will look like:
# sk_live_1234567890abcdef1234567890abcdef
# Step 4: Use your API key
# Include it in the Authorization header of your requests:
Authorization: Bearer sk_live_1234567890abcdef1234567890abcdef
# Or use it with the SDK:
from memory_scope import MemoryScopeClient
client = MemoryScopeClient(
api_key="sk_live_1234567890abcdef1234567890abcdef"
)2
Install the SDK
Install the Python SDK using pip, or use the JavaScript/TypeScript SDK with npm.
# Python
pip install memory-scope
# JavaScript/TypeScript
npm install @memory-scope/sdk3
Store Your First Memory
Create a memory with a scope, domain, and value. The API will validate and normalize your data.
from memory_scope import MemoryScopeClient
client = MemoryScopeClient(api_key="your-api-key")
memory = client.create_memory(
user_id="user123",
scope="preferences",
domain="food",
source="explicit_user_input",
ttl_days=30,
value_json={
"likes": ["pizza", "sushi"],
"dislikes": ["broccoli"]
}
)
print(f"Created memory: {memory.id}")4
Read Memories
Read memories with policy enforcement. The API ensures your purpose is allowed for the scope.
result = client.read_memory(
user_id="user123",
scope="preferences",
domain="food",
purpose="generate food recommendations"
)
print(result.summary_text)
# "Likes: 2, Dislikes: 1, Settings: 0"
print(result.summary_struct)
# {
# "likes": ["pizza", "sushi"],
# "dislikes": ["broccoli"],
# "settings": {}
# }5
Revoke Access
Users can revoke access using the revocation token returned from read operations.
# Revoke access
client.revoke_memory(
revocation_token=result.revocation_token
)
# Subsequent reads with the same token will fail
# This ensures users have complete control over their dataNext Steps
Now that you've completed the basics, explore more advanced topics: