Documentation Index
Fetch the complete documentation index at: https://docs.qoder.com/llms.txt
Use this file to discover all available pages before exploring further.
POST /v1/memory_stores/{memory_store_id}/memories
在指定的 Memory Store 中创建一条新的记忆条目。
请求头
| 头部 | 必选 | 说明 |
|---|
Authorization | 是 | Bearer <PAT> |
Content-Type | 是 | application/json |
路径参数
| 参数 | 类型 | 必选 | 说明 |
|---|
memory_store_id | string | 是 | Memory Store ID(memstore_ 前缀) |
请求体
| 字段 | 类型 | 必选 | 说明 |
|---|
path | string | 是 | 相对路径(不能以 / 开头) |
content | string | 是 | 记忆内容(文本) |
示例请求
curl -X POST "https://openapi.qoder.sh/api/v1/cloud/memory_stores/memstore_xxx/memories" \
-H "Authorization: Bearer $QODER_PAT" \
-H "Content-Type: application/json" \
-d '{
"path": "notes/meeting.md",
"content": "会议纪要内容..."
}'
示例响应
HTTP 201 Created
{
"id": "mem_019e3bb965a671fca51bde1cf8d87de0",
"type": "memory",
"store_id": "memstore_019e3bb93b7074f9a5130d39ddcca90f",
"path": "notes/meeting.md",
"content": "会议纪要内容...",
"size": 11,
"content_sha256": "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c",
"version": 1,
"metadata": {},
"created_at": "2026-05-18T15:34:26.494349Z",
"updated_at": "2026-05-18T15:34:26.494349Z"
}
响应字段
| 字段 | 类型 | 说明 |
|---|
id | string | 唯一标识符(mem_ 前缀) |
type | string | 固定值 "memory" |
store_id | string | 所属 Memory Store 的 ID |
path | string | 相对路径 |
content | string | 记忆内容 |
size | int64 | 内容大小(字节) |
content_sha256 | string | 内容 SHA-256 哈希 |
version | int64 | 版本号(首次创建为 1) |
metadata | object | 自定义元数据 |
created_at | string | 创建时间(ISO 8601) |
updated_at | string | 最后更新时间(ISO 8601) |
错误码
| HTTP | type | 触发条件 |
|---|
| 400 | invalid_request_error | 请求参数错误(如 path 以 / 开头) |
| 401 | authentication_error | 未提供或无效的认证令牌 |
| 404 | not_found_error | 指定的 Memory Store 不存在 |
| 409 | conflict_error | 同一 Store 下已存在相同 path 的条目 |
错误响应示例:
path 以 / 开头:
{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "Field 'path' must be a relative path (cannot start with '/')."
}
}
路径冲突:
{
"type": "error",
"error": {
"type": "conflict_error",
"message": "Version or state conflict."
}
}
注意事项
path 必须是相对路径,不能以 / 开头
- 同一 Store 下不能有两个相同
path 的记忆条目(返回 409)
- 创建时版本号初始为 1
- 服务端自动计算
size 和 content_sha256
- 创建操作会同步生成一条
action: "created" 的版本记录
完整错误信封说明详见 错误参考。