> ## 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 の更新

> Memory エントリのコンテンツを更新します。

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

Memory エントリを更新します。新しいバージョンのスナップショットが自動的に作成されます。

## パスパラメータ

| パラメータ             | 説明                     |
| ----------------- | ---------------------- |
| `memory_store_id` | ストア ID（`memstore_...`） |
| `memory_id`       | Memory ID（`mem_...`）   |

## ヘッダー

| ヘッダー            | 必須 | 説明                 |
| --------------- | -- | ------------------ |
| `Authorization` | はい | `Bearer <PAT>`     |
| `Content-Type`  | はい | `application/json` |

## リクエストボディ

| フィールド            | 型      | 必須  | 説明                                          |
| ---------------- | ------ | --- | ------------------------------------------- |
| `content`        | string | はい  | 新しいコンテンツ。最大 100 KB                          |
| `content_sha256` | string | いいえ | 楽観的並行制御のための期待される SHA-256。不一致の場合は 409 を返します  |
| `metadata`       | object | いいえ | キーバリュータグ。最大 16 個のペア。キーは 1〜64 文字、値は最大 512 文字 |

## リクエスト例

```bash theme={null}
curl -X POST "https://api.qoder.com/api/v1/cloud/memory_stores/memstore_xxx/memories/mem_xxx" \
  -H "Authorization: Bearer $QODER_PAT" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "# Updated content",
    "content_sha256": "a1b2c3..."
  }'
```

## レスポンス

`content` を含む更新された [Memory オブジェクト](/ja/cloud-agents/api/memory-stores/schemas#memory-object)を返します。

## エラー

| HTTP | Type                    | トリガー                         |
| ---- | ----------------------- | ---------------------------- |
| 400  | `invalid_request_error` | 空またはサイズ超過のコンテンツ              |
| 404  | `not_found_error`       | ストアまたは Memory が存在しない         |
| 409  | `invalid_request_error` | ストアがアーカイブ済み、または SHA-256 の不一致 |
