> ## 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.

# 更新 Memory Store

> 更新 Memory Store 的名称、描述或元数据。

`POST /api/v1/cloud/memory_stores/{memory_store_id}`

更新一个 Memory Store。所有字段均可选，省略的字段保持不变。

## 请求头

| 头部              | 必选 | 说明                 |
| --------------- | -- | ------------------ |
| `Authorization` | 是  | `Bearer <PAT>`     |
| `Content-Type`  | 是  | `application/json` |

## 路径参数

| 参数                | 类型     | 必选 | 说明                              |
| ----------------- | ------ | -- | ------------------------------- |
| `memory_store_id` | string | 是  | Memory Store ID，前缀为 `memstore_` |

## 请求体

| 字段            | 类型     | 必选 | 说明                                                     |
| ------------- | ------ | -- | ------------------------------------------------------ |
| `name`        | string | 否  | 新名称，1–255 字符，不含控制字符                                    |
| `description` | string | 否  | 新描述，最长 1024 字符。传空字符串可清空                                |
| `metadata`    | object | 否  | 元数据补丁：将 key 设为字符串表示 upsert，设为 `null` 表示删除该 key；省略则保持不变 |

## 示例请求

```bash theme={null}
curl -X POST "https://api.qoder.com/api/v1/cloud/memory_stores/memstore_019e5cdb9c3f71c3b6505eba937a40b4" \
  -H "Authorization: Bearer $QODER_PAT" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "project-alpha-memory-v2",
    "metadata": {"team": null, "env": "production"}
  }'
```

## 响应

返回更新后的 [Memory Store 对象](/zh/cloud-agents/api/memory-stores/schemas#memory-store-对象)。

## 错误码

| HTTP | type                    | 触发条件                                 |
| ---- | ----------------------- | ------------------------------------ |
| 400  | `invalid_request_error` | `name`、`description` 或 `metadata` 非法 |
| 401  | `authentication_error`  | 缺少或无效的认证令牌                           |
| 404  | `not_found_error`       | 指定 ID 的 Memory Store 不存在             |

完整错误信封说明详见 [错误参考](/zh/cloud-agents/api/conventions/errors)。
