Get Memory
Retrieve a user’s memories, including factual, preference, and tool memories.
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 = {
"user_id": "memos_user_123"
}
headers = {
"Content-Type": "application/json",
"Authorization": f"Token {os.environ['MEMOS_API_KEY']}"
}
url = f"{os.environ['MEMOS_BASE_URL']}/get/memory"
res = requests.post(url=url, headers=headers, data=json.dumps(data))
print(f"result: {res.json()}")
curl --request POST \
--url https://memos.memtensor.cn/api/openmem/v1/get/memory \
--header 'Authorization: Token YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"user_id": "memos_user_123"
}'
Authorizations
Authorization
string
header
required
Token API_key, available in API Console > API Keys
Body
application/json
user_id
string
required
Unique identifier of the user whose memories are being retrieved.
page
number
default: 1
Page number for pagination when many results are returned.
size
number
default: 10
Number of entries returned per memory category on the current page, up to 50.
filter
object
Filter conditions, used to precisely limit the memory scope before retrieval. Available fields include: "agent_id", "app_id", "create_time", "update_time", and specific fields in "info". Supports logical operators (and, or) and comparison operators (gte, lte, gt, lt). For the "info" field, supports filtering by "business_type", "biz_id", "scene", and other custom fields.
Example:
"{"and": [{"create_time":{"gte":"..."}}]}"
include_preference
boolean
default: true
Whether preference memories should be included.
include_tool_memory
boolean
default: true
Whether tool memories should be included.
Response
application/json
Successful Response
code
number
required
API status code; refer to the error-code list for details.
data
object
Show child attributes
message
string
required
API 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 = {
"user_id": "memos_user_123"
}
headers = {
"Content-Type": "application/json",
"Authorization": f"Token {os.environ['MEMOS_API_KEY']}"
}
url = f"{os.environ['MEMOS_BASE_URL']}/get/memory"
res = requests.post(url=url, headers=headers, data=json.dumps(data))
print(f"result: {res.json()}")
curl --request POST \
--url https://memos.memtensor.cn/api/openmem/v1/get/memory \
--header 'Authorization: Token YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"user_id": "memos_user_123"
}'