Skip to content

Agent Memory

The Agent Memory API gives you programmatic control over the long-term memory store that backs each Horizon agent. Memories are stored in Supabase and allow agents to recall context, preferences, and learned information across conversations. Every endpoint in this section requires x-api-key authentication.


GET/api/agents/:agentId/memories

Retrieve a paginated list of memories for a specific agent, with optional tag filtering.

Requires authentication via x-api-key header.

Path Parameters

ParameterTypeDescription
agentId requiredstringThe unique identifier of the agent whose memories to list.

Query Parameters

ParameterTypeDescription
limitnumberMaximum number of memories to return. Default: 50, Max: 200.
offsetnumberNumber of results to skip for pagination. Default: 0.
tagstringFilter memories by tag (exact match). For example, 'preference' or 'customer-context'.
curl
curl -X GET "https://api.horizonplatform.ai/api/agents/agent_001/memories?limit=10&tag=preference" \
-H "x-api-key: hz_live_abc123def456"
JavaScript
const params = new URLSearchParams({
limit: '10',
tag: 'preference',
});
const response = await fetch(
`https://api.horizonplatform.ai/api/agents/agent_001/memories?${params}`,
{ headers: { 'x-api-key': 'hz_live_abc123def456' } }
);
const memories = await response.json();
console.log(memories);
Python
import requests
response = requests.get(
'https://api.horizonplatform.ai/api/agents/agent_001/memories',
headers={'x-api-key': 'hz_live_abc123def456'},
params={
'limit': 10,
'tag': 'preference',
}
)
memories = response.json()
print(memories)
// 200 OK
{
"data": [
{
"id": "mem_a1b2c3d4",
"agent_id": "agent_001",
"content": "User prefers accrual-basis accounting for all financial reports.",
"tag": "preference",
"metadata": {
"source": "conversation",
"conversation_id": "conv_8f3a2b1c"
},
"created_at": "2026-03-10T08:15:00Z",
"updated_at": "2026-03-10T08:15:00Z"
},
{
"id": "mem_e5f6g7h8",
"agent_id": "agent_001",
"content": "Default reporting currency is USD.",
"tag": "preference",
"metadata": {},
"created_at": "2026-03-08T14:22:00Z",
"updated_at": "2026-03-08T14:22:00Z"
}
],
"total": 2,
"limit": 10,
"offset": 0
}

GET/api/agents/:agentId/memories/:memoryId

Retrieve a single memory by its identifier.

Requires authentication via x-api-key header.

Path Parameters

ParameterTypeDescription
agentId requiredstringThe agent identifier.
memoryId requiredstringThe unique memory identifier.
curl
curl -X GET https://api.horizonplatform.ai/api/agents/agent_001/memories/mem_a1b2c3d4 \
-H "x-api-key: hz_live_abc123def456"
JavaScript
const response = await fetch(
'https://api.horizonplatform.ai/api/agents/agent_001/memories/mem_a1b2c3d4',
{ headers: { 'x-api-key': 'hz_live_abc123def456' } }
);
const memory = await response.json();
Python
import requests
response = requests.get(
'https://api.horizonplatform.ai/api/agents/agent_001/memories/mem_a1b2c3d4',
headers={'x-api-key': 'hz_live_abc123def456'}
)
memory = response.json()
// 200 OK
{
"id": "mem_a1b2c3d4",
"agent_id": "agent_001",
"content": "User prefers accrual-basis accounting for all financial reports.",
"tag": "preference",
"metadata": {
"source": "conversation",
"conversation_id": "conv_8f3a2b1c"
},
"created_at": "2026-03-10T08:15:00Z",
"updated_at": "2026-03-10T08:15:00Z"
}

PUT/api/agents/:agentId/memories/:memoryId

Update the content, tag, or metadata of an existing memory.

Requires authentication via x-api-key header.

Path Parameters

ParameterTypeDescription
agentId requiredstringThe agent identifier.
memoryId requiredstringThe memory identifier to update.

Request Body

ParameterTypeDescription
contentstringThe updated memory content text.
tagstringA tag for categorizing the memory (e.g., 'preference', 'fact', 'customer-context').
metadataobjectArbitrary key-value metadata to attach to the memory.
curl
curl -X PUT https://api.horizonplatform.ai/api/agents/agent_001/memories/mem_a1b2c3d4 \
-H "x-api-key: hz_live_abc123def456" \
-H "Content-Type: application/json" \
-d '{
"content": "User prefers accrual-basis accounting. Also prefers quarterly breakdowns.",
"tag": "preference",
"metadata": {
"source": "conversation",
"conversation_id": "conv_8f3a2b1c",
"updated_reason": "User clarified reporting preference"
}
}'
JavaScript
const response = await fetch(
'https://api.horizonplatform.ai/api/agents/agent_001/memories/mem_a1b2c3d4',
{
method: 'PUT',
headers: {
'x-api-key': 'hz_live_abc123def456',
'Content-Type': 'application/json',
},
body: JSON.stringify({
content: 'User prefers accrual-basis accounting. Also prefers quarterly breakdowns.',
tag: 'preference',
metadata: {
source: 'conversation',
conversation_id: 'conv_8f3a2b1c',
updated_reason: 'User clarified reporting preference',
},
}),
}
);
const updated = await response.json();
Python
import requests
response = requests.put(
'https://api.horizonplatform.ai/api/agents/agent_001/memories/mem_a1b2c3d4',
headers={
'x-api-key': 'hz_live_abc123def456',
'Content-Type': 'application/json',
},
json={
'content': 'User prefers accrual-basis accounting. Also prefers quarterly breakdowns.',
'tag': 'preference',
'metadata': {
'source': 'conversation',
'conversation_id': 'conv_8f3a2b1c',
'updated_reason': 'User clarified reporting preference',
},
}
)
updated = response.json()
// 200 OK
{
"id": "mem_a1b2c3d4",
"agent_id": "agent_001",
"content": "User prefers accrual-basis accounting. Also prefers quarterly breakdowns.",
"tag": "preference",
"metadata": {
"source": "conversation",
"conversation_id": "conv_8f3a2b1c",
"updated_reason": "User clarified reporting preference"
},
"created_at": "2026-03-10T08:15:00Z",
"updated_at": "2026-03-18T11:42:00Z"
}

DELETE/api/agents/:agentId/memories/:memoryId

Permanently delete a memory. This action cannot be undone.

Requires authentication via x-api-key header.

Path Parameters

ParameterTypeDescription
agentId requiredstringThe agent identifier.
memoryId requiredstringThe memory identifier to delete.
curl
curl -X DELETE https://api.horizonplatform.ai/api/agents/agent_001/memories/mem_a1b2c3d4 \
-H "x-api-key: hz_live_abc123def456"
JavaScript
const response = await fetch(
'https://api.horizonplatform.ai/api/agents/agent_001/memories/mem_a1b2c3d4',
{
method: 'DELETE',
headers: { 'x-api-key': 'hz_live_abc123def456' },
}
);
// 204 No Content on success
Python
import requests
response = requests.delete(
'https://api.horizonplatform.ai/api/agents/agent_001/memories/mem_a1b2c3d4',
headers={'x-api-key': 'hz_live_abc123def456'}
)
# 204 No Content on success

A successful deletion returns 204 No Content with an empty response body.


Status Error Description
401 authentication_required Missing or invalid API key.
403 insufficient_scope API key lacks the required scope for this agent.
404 not_found The specified agent or memory does not exist.
400 validation_error Invalid request body or query parameter values.
429 rate_limit_exceeded API key rate limit exceeded.