Core Operations

Get Memories

Retrieve paginated memories for a user or Agent.

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": "activated",
        "confidence": 0,
        "tags": [
          "<string>"
        ],
        "update_time": "<string>",
        "relativity": 0,
        "sources": [
          {}
        ],
        "info": {}
      }
    ],
    "preference_detail_list": [
      {
        "id": "<string>",
        "preference_type": "explicit_preference",
        "preference": "<string>",
        "reasoning": "<string>",
        "create_time": "<string>",
        "conversation_id": "<string>",
        "status": "activated",
        "update_time": "<string>",
        "relativity": 0,
        "sources": [
          {}
        ],
        "info": {}
      }
    ],
    "profile_detail_list": [
      {
        "id": "<string>",
        "project_id": "<string>",
        "profile_template_id": "<string>",
        "properties": {},
        "status": "activated",
        "created_at": "<string>",
        "updated_at": "<string>"
      }
    ],
    "event_detail_list": [
      {
        "id": "<string>",
        "event_key": "<string>",
        "event_value": "<string>",
        "event_type": "<string>",
        "create_time": "<string>",
        "conversation_id": "<string>",
        "status": "activated",
        "update_time": "<string>",
        "info": {},
        "sources": [
          {}
        ],
        "event_time": [
          "<string>"
        ],
        "event_location": [
          "<string>"
        ],
        "event_roles": [
          "<string>"
        ]
      }
    ],
    "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>",
        "relativity": 0,
        "source": "<string>",
        "experience": "<string>",
        "info": {}
      }
    ],
    "skill_detail_list": [
      {
        "id": "<string>",
        "skill_value": {
          "name": "<string>",
          "description": "<string>",
          "procedure": "<string>",
          "experience": [
            "<string>"
          ],
          "preference": [
            "<string>"
          ],
          "examples": [
            "<string>"
          ],
          "script": {},
          "others": {}
        },
        "skill_url": "<string>",
        "skill_type": "<string>",
        "create_time": "<string>",
        "conversation_id": "<string>",
        "status": "activated",
        "confidence": 0,
        "tags": [
          "<string>"
        ],
        "update_time": "<string>",
        "relativity": "<string>"
      }
    ],
    "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
Unique identifier of the user whose memories are being retrieved.
agent_id
string
Unique identifier of the Agent whose memories are being retrieved. Available only when independent Agent memory is enabled. Use either user_id or agent_id.
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_memory_view
string[]
Allowed memory types to retrieve. When omitted, all memory types are returned by default. See Memory Types for values.
Enum:"detail_factual""preference""skill""profile""event""tool_memory"

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.