Core Operations

Update Memory

Manually update memory.

1. Overview

This API manually updates an existing memory. Typical use cases include correcting memory content and archiving outdated memories.


2. Key Parameters

FieldTypeRequiredDescription
memory_idstringYesThe memory ID, from the id field returned by search/memory or get/memory
contentstringNoThe updated memory content
titlestringNoThe updated memory title
statusstringNoMemory status

3. Usage Example

3.1 Find the Memory to Update

When you call Search Memory or get memories, each returned memory has its own id. Use that id as memory_id when updating.


3.2 Call the Update API

import requests

API_KEY = "YOUR_API_KEY"
BASE_URL = "https://memos.memtensor.cn/api/openmem/v1"

data = {
    "memory_id": "mem_event_001",
    "title": "Camping at West Lake with Chen Mo",
    "content": "Last Saturday I went camping by West Lake with my friend Chen Mo. The weather was great and we watched the stars together at night."
}

res = requests.post(
    f"{BASE_URL}/update/memory",
    headers={"Authorization": f"Token {API_KEY}"},
    json=data
)

print(res.json())

4. Response

The API returns code: 0 when the update succeeds. After updating, you can verify the result with Search Memory or get/memory/{memory_id}.

{
  "code": 0,
  "message": "ok",
  "data": {
    "success": true
  }
}
To permanently delete a memory, use the Delete Memory API.

5. Common Errors and Troubleshooting

Error CodeCommon CauseHow to Fix
40000The request body is invalid, or a field type is incorrectConfirm memory_id is a string and status is one of the allowed values
40002A required field is emptyCheck whether memory_id was passed
40103 / 40132The API Key is invalid, expired, or cannot access the current projectGo back to Project Configuration and check whether the API Key matches the project
40307The memory_id does not existGet the latest id from search/memory or get/memory

For more error code details, see Error Codes.