Skip to main content

Memories API

Create, read, update, and delete memories.

Create Memory

POST /v1/memories

Request Body

FieldTypeRequiredDescription
textstringYesMemory content (1-50,000 chars)
metadataobjectNoKey-value metadata
memory_idstringNoCustom ID
space_idstringNoMemory space to store in

Example

curl -X POST https://api.memory.tensorheart.com/v1/memories \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "User works as a data scientist at TechCorp",
"metadata": {"category": "professional"},
"space_id": "work"
}'

Response

{
"success": true,
"data": {
"id": "mem_abc123",
"text": "User works as a data scientist at TechCorp",
"metadata": {"category": "professional"},
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
}

List Memories

GET /v1/memories

Query Parameters

ParameterTypeDefaultDescription
pageint1Page number
per_pageint50Items per page (max 100)
space_idstringnullFilter by memory space

Example

curl "https://api.memory.tensorheart.com/v1/memories?page=1&per_page=20&space_id=work" \
-H "Authorization: Bearer $API_KEY"

Get Memory

GET /v1/memories/{memory_id}

Example

curl https://api.memory.tensorheart.com/v1/memories/mem_abc123 \
-H "Authorization: Bearer $API_KEY"

Update Memory

PUT /v1/memories/{memory_id}

Request Body

FieldTypeRequiredDescription
textstringNoUpdated text
metadataobjectNoUpdated metadata (replaces existing)

Example

curl -X PUT https://api.memory.tensorheart.com/v1/memories/mem_abc123 \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "User is a senior data scientist at TechCorp"}'

Delete Memory

DELETE /v1/memories/{memory_id}

Example

curl -X DELETE https://api.memory.tensorheart.com/v1/memories/mem_abc123 \
-H "Authorization: Bearer $API_KEY"

Delete All Memories

DELETE /v1/memories?confirm=true
Destructive Action

This permanently deletes all memories. The confirm=true parameter is required.

Example

curl -X DELETE "https://api.memory.tensorheart.com/v1/memories?confirm=true" \
-H "Authorization: Bearer $API_KEY"

Consolidate Memories

Merge similar memories to reduce redundancy.

POST /v1/memories/consolidate

Request Body

FieldTypeDefaultDescription
space_idstringnullLimit to specific space
similarity_thresholdfloat0.85Similarity threshold (0.5-1.0)
max_consolidationsint50Max merges to perform
dry_runboolfalsePreview without applying

Example

curl -X POST https://api.memory.tensorheart.com/v1/memories/consolidate \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"similarity_threshold": 0.85,
"dry_run": true
}'

Response

{
"success": true,
"data": {
"dry_run": true,
"would_consolidate": 5,
"would_merge": 12,
"preview": [
{
"memory_ids": ["mem_1", "mem_2"],
"texts": ["User likes coffee", "User enjoys coffee"]
}
]
}
}