> ## 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 エントリを作成します。`content` を含む作成された Memory を返します。

## パスパラメータ

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

## ヘッダー

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

## リクエストボディ

| フィールド      | 型      | 必須  | 説明                                          |
| ---------- | ------ | --- | ------------------------------------------- |
| `path`     | string | はい  | エントリパス。最大 1024 文字。`..` を含めることはできません         |
| `content`  | string | はい  | エントリコンテンツ。最大 100 KB                         |
| `metadata` | object | いいえ | キーバリュータグ。最大 16 個のペア。キーは 1〜64 文字、値は最大 512 文字 |

## リクエスト例

```bash theme={null}
curl -X POST "https://api.qoder.com/api/v1/cloud/memory_stores/memstore_xxx/memories" \
  -H "Authorization: Bearer $QODER_PAT" \
  -H "Content-Type: application/json" \
  -d '{
    "path": "decisions/arch-choice.md",
    "content": "# Architecture Decision\n\nChose microservices."
  }'
```

## レスポンス

```json theme={null}
{
  "id": "mem_019e5cdba1b674e4a6a7d4f8c9b3e2a1",
  "type": "memory",
  "memory_store_id": "memstore_019e5cdb9c3f71c3b6505eba937a40b4",
  "path": "decisions/arch-choice.md",
  "content": "# Architecture Decision\n\nChose microservices.",
  "content_size_bytes": 46,
  "content_sha256": "a1b2c3...",
  "version": 1,
  "metadata": {},
  "created_at": "2026-05-18T08:01:00.000Z",
  "updated_at": "2026-05-18T08:01:00.000Z"
}
```

## エラー

| HTTP | Type                    | トリガー                     |
| ---- | ----------------------- | ------------------------ |
| 400  | `invalid_request_error` | 無効なパス、空またはサイズ超過のコンテンツ    |
| 404  | `not_found_error`       | ストアが存在しない                |
| 409  | `invalid_request_error` | ストアがアーカイブ済み、またはパスが既に存在する |
