Memory API
Endpoints for managing memory stores and performing semantic memory operations.
Stores
List Stores
GET /api/client/v1/memory/stores?status=active&search=agentCreate Store
POST /api/client/v1/memory/stores{
"name": "Agent Working Memory",
"vectorProviderKey": "pinecone-prod",
"embeddingModelKey": "text-embedding-ada-002",
"description": "Memory for the research agent"
}Status: 201
Create and update bodies may carry a config object with deduplication, defaultScope, maxMemories and ttlDays. maxMemories (a store refuses new memories with 409 once it holds that many) and ttlDays (memories expire that many days after they are written or their content changes) are available only through the API; the console has no field for them. Expired memories are ignored by search and recall and by the maxMemories count.
Get Store
GET /api/client/v1/memory/stores/:storeKeyUpdate Store
PATCH /api/client/v1/memory/stores/:storeKey{ "name": "Updated Name", "status": "inactive" }Delete Store
DELETE /api/client/v1/memory/stores/:storeKeyDeletes the store and its vector index.
Memory Items
Add Memory
POST /api/client/v1/memory/stores/:storeKey/memories{
"content": "User prefers dark mode and concise responses",
"scope": "user",
"scopeId": "user-123",
"tags": ["preferences", "ui"],
"importance": 0.8,
"metadata": { "source": "conversation" }
}Status: 201
With the store setting deduplication on (the default), a memory with the same content as an existing one returns the existing memory. If the existing one has expired, it gets a new expiry. A store that already holds maxMemories answers 409. importance (0 to 1, default 0.5) is stored and returned but does not change how search results are ranked.
Add Batch
POST /api/client/v1/memory/stores/:storeKey/memories/batch{
"memories": [
{ "content": "Memory 1", "scope": "user", "tags": ["pref"] },
{ "content": "Memory 2", "scope": "session", "importance": 0.5 }
]
}Maximum 100 items per batch. Status: 201
The response reports how many items were added, skipped as duplicates and failed:
{ "added": 98, "duplicates": 1, "failed": 1 }A write that cannot be completed is counted in failed and is not reported as a success. When nothing was added and nothing was a duplicate, the call answers with the underlying error instead of a count. Once the store is full (maxMemories), the remaining items are counted as failed; when nothing could be added the call answers 409. An item without a string content, more than 100 items, or an empty memories array answers 400. The call counts once against the quota.
List Memories
GET /api/client/v1/memory/stores/:storeKey/memories?scope=user&scopeId=user-123&tags=preferences&limit=50{ "items": [...], "total": 25 }| Query Parameter | Description |
|---|---|
scope | Filter by scope (user, agent, session, global) |
scopeId | Filter by scope ID |
tags | Comma-separated tag filter |
status | Filter by status (active, archived, expired) |
search | Full-text search in content |
limit | Page size (default 50) |
skip | Offset for pagination |
Get Memory
GET /api/client/v1/memory/stores/:storeKey/memories/:memoryIdUpdate Memory
PATCH /api/client/v1/memory/stores/:storeKey/memories/:memoryId{ "content": "Updated content", "importance": 0.9 }If content changes, the embedding is regenerated automatically.
Delete Memory
DELETE /api/client/v1/memory/stores/:storeKey/memories/:memoryIdBulk Delete
DELETE /api/client/v1/memory/stores/:storeKey/memories?scope=user&scopeId=user-123&tags=tempBulk delete also removes the deleted memories from the vector index, so later search and recall results stay aligned with the remaining memory items. The filters (scope, scopeId, tags) are combined, and only memories of the store in the token's project are touched. Answers { "deleted": <count> }.
Search
Memories are always read within the token's project. Archived and expired memories are never returned.
Semantic Search
POST /api/client/v1/memory/stores/:storeKey/search{
"query": "What are the user's UI preferences?",
"topK": 10,
"minScore": 0.7,
"scope": "user",
"scopeId": "user-123",
"tags": ["preferences"]
}| Field | Type | Default | Description |
|---|---|---|---|
query | string | — | Search query text |
topK | number | 10 | Maximum results |
minScore | number | — | Minimum similarity score |
scope | string | — | Filter by scope |
scopeId | string | — | Filter by scope ID |
tags | string[] | — | Filter by tags |
Response:
{
"memories": [
{
"id": "mem_123",
"content": "User prefers dark mode and concise responses",
"score": 0.94,
"scope": "user",
"scopeId": "user-123",
"tags": ["preferences", "ui"],
"metadata": { "source": "conversation" },
"importance": 0.8
}
],
"query": "What are the user's UI preferences?",
"storeKey": "mem-agent-working-memory"
}Recall for Chat
POST /api/client/v1/memory/stores/:storeKey/recall{
"query": "What should I remember before answering?",
"topK": 5,
"scope": "user",
"scopeId": "user-123",
"maxTokens": 800
}Response:
{
"context": "- User prefers dark mode and concise responses",
"memories": [
{
"id": "mem_123",
"content": "User prefers dark mode and concise responses",
"score": 0.94,
"scope": "user",
"scopeId": "user-123",
"tags": ["preferences", "ui"],
"metadata": { "source": "conversation" },
"importance": 0.8
}
],
"storeKey": "mem-agent-working-memory"
}Errors
| Status | Description |
|---|---|
| 400 | Missing required fields, or a request body that is not a JSON object |
| 409 | The store already holds maxMemories memories |
| 401 | Invalid API token |
| 404 | Store or memory not found |
| 429 | Rate limit or quota exceeded |

