在指定的 Memory Store 中创建一条新的记忆条目。
请求头
头部 | 必选 | 说明 |
| 是 |
|
| 是 |
|
路径参数
参数 | 类型 | 必选 | 说明 |
| string | 是 | Memory Store ID( |
请求体
字段 | 类型 | 必选 | 说明 |
| string | 是 | 相对路径(不能以 |
| string | 是 | 记忆内容(文本) |
示例请求
curl -X POST "https://api.qoder.com.cn/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"
}响应字段
字段 | 类型 | 说明 |
| string | 唯一标识符( |
| string | 固定值 |
| string | 所属 Memory Store 的 ID |
| string | 相对路径 |
| string | 记忆内容 |
| int64 | 内容大小(字节) |
| string | 内容 SHA-256 哈希 |
| int64 | 版本号(首次创建为 1) |
| object | 自定义元数据 |
| string | 创建时间(ISO 8601) |
| string | 最后更新时间(ISO 8601) |
错误码
HTTP | type | 触发条件 |
400 |
| 请求参数错误(如 |
401 |
| 未提供或无效的认证令牌 |
404 |
| 指定的 Memory Store 不存在 |
409 |
| 同一 Store 下已存在相同 |
错误响应示例:
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"的版本记录
完整错误信封说明详见 错误参考。