Get Memory

Retrieve a user’s memories, including factual, preference, and tool memories.

POST
/
get
/
memory
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()}")
{
  "code": 0,
  "data": {
    "memory_detail_list": [
      {
        "id": "<string>",
        "memory_key": "<string>",
        "memory_value": "<string>",
        "memory_type": "WorkingMemory",
        "create_time": "<string>",
        "conversation_id": "<string>",
        "status": "<string>",
        "confidence": 0,
        "tags": [
          "<string>"
        ],
        "update_time": "<string>",
        "sources": [
          {}
        ],
        "info": {}
      }
    ],
    "preference_detail_list": [
      {
        "id": "<string>",
        "preference_type": "explicit_preference",
        "preference": "<string>",
        "reasoning": "<string>",
        "create_time": "<string>",
        "conversation_id": "<string>",
        "status": "<string>",
        "update_time": "<string>",
        "sources": [
          {}
        ],
        "info": {}
      }
    ],
    "tool_memory_detail_list": [
      {
        "id": "<string>",
        "tool_type": "ToolTrajectoryMemory",
        "tool_value": "<string>",
        "tool_used_status": [
          {
            "used_tool": "<string>",
            "error_type": "<string>",
            "success_rate": 0,
            "tool_experience": "<string>"
          }
        ],
        "create_time": "<string>",
        "conversation_id": "<string>",
        "status": "activated",
        "update_time": "<string>",
        "experience": "<string>",
        "sources": [
          {}
        ],
        "info": {}
      }
    ],
    "total": 0,
    "size": 0,
    "current": 0,
    "pages": 0
  },
  "message": "<string>"
}

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.