Skip to main content

Quickstart

Get started with the Tensorheart Memory API in 5 minutes.

1. Create an Account​

Sign up to get your API key:

curl -X POST https://memoryapi.tensorheart.com/v1/signup \
-H "Content-Type: application/json" \
-d '{
"name": "My Company",
"email": "you@example.com"
}'

Response:

{
"success": true,
"data": {
"id": "key_abc123",
"name": "Default Key",
"key": "mem_live_your_secret_key_here",
"key_prefix": "mem_live_abc",
"environment": "live",
"scopes": ["read", "write"],
"created_at": "2024-01-15T10:30:00Z",
"expires_at": null
}
}
Save Your API Key

The full API key is only shown once. Save it securely!

2. Extract Your First Memories​

The Memory API uses intelligent extraction to create memories from conversations and documents. This ensures high-quality, structured memories.

export API_KEY="mem_live_your_api_key"

curl -X POST https://memoryapi.tensorheart.com/v1/query/extract \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "User: Hi, I prefer dark mode interfaces. I work as a data scientist at TechCorp and use Python daily.",
"content_type": "conversation"
}'

Response:

{
"success": true,
"data": {
"memories_created": 3,
"memory_ids": ["mem_abc123", "mem_def456", "mem_ghi789"],
"extracted_memories": [
"User prefers dark mode interfaces",
"User works as a data scientist at TechCorp",
"User uses Python daily"
]
},
"meta": {
"request_id": "req_abc123",
"processing_time_ms": 450
}
}
Why Extraction?

Extraction uses AI to identify and structure important information, creating higher-quality memories than manual entry. It also handles deduplication and conflict resolution automatically.

3. Query Your Memories​

curl -X POST https://memoryapi.tensorheart.com/v1/query \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"context": "What are the users UI preferences?",
"max_memories": 5,
"search_depth": 0.5
}'
Control Search Thoroughness

Use search_depth (0-1) to balance speed and accuracy. Higher values search more comprehensively but cost more. Default is 0.5.

Response:

{
"success": true,
"data": {
"memories": [
{
"id": "mem_xyz789",
"text": "User prefers dark mode interfaces",
"relevance_score": 0.92,
"metadata": {"category": "preference"}
}
],
"query_context": "What are the users UI preferences?",
"total_memories_searched": 10
},
"meta": {
"request_id": "req_def456",
"processing_time_ms": 120
}
}

4. Get an AI Answer​

curl -X POST https://memoryapi.tensorheart.com/v1/query/answer \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"context": "What theme should I use for the users dashboard?"
}'

Response:

{
"success": true,
"data": {
"answer": "Based on the user's preferences, you should use a dark theme for the dashboard. The user has indicated they prefer dark mode interfaces.",
"memories_used": [
{
"id": "mem_xyz789",
"text": "User prefers dark mode interfaces",
"relevance_score": 0.92,
"metadata": {"category": "preference"}
}
],
"confidence": null,
"model": "gpt-4o-mini"
},
"meta": {
"request_id": "req_ghi789",
"processing_time_ms": 850
}
}

Next Steps​