列出 Memory

更新时间:
复制 MD 格式

列出记忆库内的记忆文件,按路径排序,支持路径前缀过滤。

前提

已完成 Endpoint 与鉴权配置,详见API 总览与认证。

接口

GET/memory_stores/{memory_store_id}/memories

路径参数

memory_store_idstring必填

记忆库 ID

查询参数

path_prefixstring可选

目录前缀过滤,以 / 开头和结尾,例如 /notes/;最大 1024 UTF-8 bytes

depth0 / 1可选

0 递归列举全部文件(默认);1 只列举当前层文件,并通过 prefixes 返回子目录

viewbasic / full可选

basic 不含正文(默认);full 含正文

limitinteger可选

单页条数。basic 为 1-100 默认 20;full 为 1-20

pagestring可选

分页游标。翻页时保持其余查询参数与 limit 不变

响应字段

dataarray<object>

记忆数组;view=basic 时不含 content

idstring

记忆 ID,格式 mem_xxx

typestring

固定为 memory

memory_store_idstring

所属记忆库 ID

pathstring

记忆库内路径,以 / 开头

contentstring

正文,UTF-8 文本;view=full 或单条读取时返回

content_sha256string

正文的 SHA256 哈希,可用作条件更新的乐观锁

content_size_bytesinteger

正文的 UTF-8 字节数

memory_version_idstring

当前版本 ID,格式 memver_xxx

created_atstring

创建时间,ISO 8601 UTC

updated_atstring

最近更新时间,ISO 8601 UTC

prefixesarray<string>

depth=1 时返回当前层下的子目录前缀

next_pagestring | null

下一页游标;无更多数据时不含该字段

请求示例

curl "$AGENTSTUDIO_URL/memory_stores/memstore_xxx/memories" \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY"

响应示例

{
  "data": [
    {
      "id": "mem_xxx",
      "type": "memory",
      "memory_store_id": "memstore_xxx",
      "path": "/notes/project.md",
      "content": "# 项目约定\n默认开发环境为预发环境。\n",
      "content_sha256": "e3b0c44b98fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
      "content_size_bytes": 47,
      "memory_version_id": "memver_xxx",
      "created_at": "2026-09-17T08:00:00Z",
      "updated_at": "2026-09-17T08:00:00Z"
    }
  ],
  "prefixes": [],
  "next_page": null
}

错误码

状态码错误码说明
400invalid_request_error参数、路径、limit 或分页游标非法
401InvalidApiKeyAPI Key 缺失、错误或失效
403permission_error身份或资源访问权限不足
404not_found_error资源不存在或不属于当前工作空间