Skip to content

Memory API ​

Endpoints for managing memory stores and performing semantic memory operations.

Stores ​

List Stores ​

GET /api/client/v1/memory/stores?status=active&search=agent

Create Store ​

POST /api/client/v1/memory/stores
json
{
  "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/:storeKey

Update Store ​

PATCH /api/client/v1/memory/stores/:storeKey
json
{ "name": "Updated Name", "status": "inactive" }

Delete Store ​

DELETE /api/client/v1/memory/stores/:storeKey

Deletes the store and its vector index.

Memory Items ​

Add Memory ​

POST /api/client/v1/memory/stores/:storeKey/memories
json
{
  "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
json
{
  "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:

json
{ "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
json
{ "items": [...], "total": 25 }
Query ParameterDescription
scopeFilter by scope (user, agent, session, global)
scopeIdFilter by scope ID
tagsComma-separated tag filter
statusFilter by status (active, archived, expired)
searchFull-text search in content
limitPage size (default 50)
skipOffset for pagination

Get Memory ​

GET /api/client/v1/memory/stores/:storeKey/memories/:memoryId

Update Memory ​

PATCH /api/client/v1/memory/stores/:storeKey/memories/:memoryId
json
{ "content": "Updated content", "importance": 0.9 }

If content changes, the embedding is regenerated automatically.

Delete Memory ​

DELETE /api/client/v1/memory/stores/:storeKey/memories/:memoryId

Bulk Delete ​

DELETE /api/client/v1/memory/stores/:storeKey/memories?scope=user&scopeId=user-123&tags=temp

Bulk 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> }.

Memories are always read within the token's project. Archived and expired memories are never returned.

POST /api/client/v1/memory/stores/:storeKey/search
json
{
  "query": "What are the user's UI preferences?",
  "topK": 10,
  "minScore": 0.7,
  "scope": "user",
  "scopeId": "user-123",
  "tags": ["preferences"]
}
FieldTypeDefaultDescription
querystring—Search query text
topKnumber10Maximum results
minScorenumber—Minimum similarity score
scopestring—Filter by scope
scopeIdstring—Filter by scope ID
tagsstring[]—Filter by tags

Response:

json
{
  "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
json
{
  "query": "What should I remember before answering?",
  "topK": 5,
  "scope": "user",
  "scopeId": "user-123",
  "maxTokens": 800
}

Response:

json
{
  "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 ​

StatusDescription
400Missing required fields, or a request body that is not a JSON object
409The store already holds maxMemories memories
401Invalid API token
404Store or memory not found
429Rate limit or quota exceeded

Studio · Pulse · Console · Agent SDK and more — the Cognipeer documentation hub