Delete Memory
Delete memories for a user or Agent. Supports deletion by memory_ids or clearing all memories by user_id/agent_id.
POST
import os
import requests
import json
# Replace with your API Key
os.environ["MEMOS_API_KEY"] = "YOUR_API_KEY"
os.environ["MEMOS_BASE_URL"] = "https://memos.memtensor.cn/api/openmem/v1"
data = {
"memory_ids": ["6b23b583-f4c4-4a8f-b345-58d0c48fea04"] # Replace with real Memory ID
}
headers = {
"Content-Type": "application/json",
"Authorization": f"Token {os.environ['MEMOS_API_KEY']}"
}
url = f"{os.environ['MEMOS_BASE_URL']}/delete/memory"
res = requests.post(url=url, headers=headers, data=json.dumps(data))
print(f"result: {res.json()}")
# Ensure MemoS is installed (pip install MemoryOS -U)
from memos.api.client import MemOSClient
# Initialize client with API Key
client = MemOSClient(api_key="YOUR_API_KEY")
memory_ids = ["6b23b583-f4c4-4a8f-b345-58d0c48fea04"] # Replace with real Memory ID
res = client.delete_memory(memory_ids=memory_ids)
print(f"result: {res}")
curl --request POST \
--url https://memos.memtensor.cn/api/openmem/v1/delete/memory \
--header 'Authorization: Token YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"memory_ids": ["6b23b583-f4c4-4a8f-b345-58d0c48fea04"]
}'
{
"code": 0,
"data": {
"success": true
},
"message": "<string>"
}Authorizations
Authorization
string
header
required
Token API_key, available in API Console > API Keys
Body
application/json
memory_ids
string[]
List of memory IDs to delete.
user_id
string
Delete all memories of this user in the current project. Mutually exclusive with memory_ids and agent_id.
agent_id
string
Delete all memories of this Agent in the current project. Available only when independent Agent memory is enabled. Mutually exclusive with memory_ids and user_id.
Response
application/json
Successful Response
code
number
API status code. See Error Code for details.
data
object
Returned deletion information
Show child attributes
message
string
API response message
import os
import requests
import json
# Replace with your API Key
os.environ["MEMOS_API_KEY"] = "YOUR_API_KEY"
os.environ["MEMOS_BASE_URL"] = "https://memos.memtensor.cn/api/openmem/v1"
data = {
"memory_ids": ["6b23b583-f4c4-4a8f-b345-58d0c48fea04"] # Replace with real Memory ID
}
headers = {
"Content-Type": "application/json",
"Authorization": f"Token {os.environ['MEMOS_API_KEY']}"
}
url = f"{os.environ['MEMOS_BASE_URL']}/delete/memory"
res = requests.post(url=url, headers=headers, data=json.dumps(data))
print(f"result: {res.json()}")
# Ensure MemoS is installed (pip install MemoryOS -U)
from memos.api.client import MemOSClient
# Initialize client with API Key
client = MemOSClient(api_key="YOUR_API_KEY")
memory_ids = ["6b23b583-f4c4-4a8f-b345-58d0c48fea04"] # Replace with real Memory ID
res = client.delete_memory(memory_ids=memory_ids)
print(f"result: {res}")
curl --request POST \
--url https://memos.memtensor.cn/api/openmem/v1/delete/memory \
--header 'Authorization: Token YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"memory_ids": ["6b23b583-f4c4-4a8f-b345-58d0c48fea04"]
}'
{
"code": 0,
"data": {
"success": true
},
"message": "<string>"
}