# API リファレンス

> API キーで組織の利用状況を取得し、SEO キーワードを追加する方法です。

<!-- Generated by bun run api:generate. Edit packages/contracts and packages/codegen/src/artifacts.ts. -->

このリファレンスは、組織・キーの情報を取得する操作と、キーワードを追加する操作を扱います。ほかの既存 API の一覧は、アプリの「開発者」→「ドキュメント」で確認できます。

## 接続と認証

本番のベース URL は `https://app.mukumo.com/api/v1` です。組織の有料プランと API キーが必要です。アプリの「開発者」からキーを作り、Authorization ヘッダーへ渡します。キーをブラウザーのコードや公開リポジトリに含めないでください。

```http
Authorization: Bearer YOUR_API_KEY
Accept-Language: ja
```

エラーの説明は Accept-Language（ja / en）で切り替わります。JSON のキーとエラーコードは共通です。キーごとに1分60回まで、月の上限は組織のプランに従います。

[OpenAPI 3.1](https://app.mukumo.com/api/v1/openapi.json)

以下の例は説明用です。実際の利用状況や上限は応答で確認してください。

## LINE のデータと変更用の版を読む

`POST /api/v1/line/read`

キー作成者の現在の担当と権限で、LINE の友だち・会話・設定を最大50件取得します。設定と友だちの詳細には、変更に使う revision と label が含まれます。

Operation ID: `readLine`

### リクエスト

```json
{
  "resource": "tags"
}
```

### 応答の例

```json
{
  "records": [],
  "total": 0,
  "limited": false
}
```

### HTTP ステータス

| Status | Description |
| --- | --- |
| 200 | LINE data and revision metadata |
| 400 | Invalid LINE input. |
| 401 | Missing, invalid or revoked API key, or a deleted organization. |
| 403 | The plan does not include the API, or writing is not permitted. |
| 404 | The LINE runtime or record is unavailable. |
| 429 | The per-key rate limit or the organization's monthly quota was exceeded. |
| 500 | An unexpected server error occurred. Use X-Request-Id when contacting support. |

## LINE の設定と配信下書きを変更する

`POST /api/v1/line/changes`

書き込みキーと作成者の現在の編集権限が必要です。変更には固定した operationId を使い、再開時は同じ入力で再使用します。更新・削除は直前に読んだ revision と label が必要です。配信は下書きに留まります。結果が不明な操作は実行し直さず、保存内容を確認してください。タグ変更やシナリオ開始は設定済みの自動通知を起動する場合があります。

Operation ID: `changeLine`

### リクエスト

```json
{
  "operationId": "11111111-1111-4111-8111-111111111111",
  "change": {
    "action": "create-tags",
    "data": {
      "name": "Example",
      "color": "blue"
    }
  }
}
```

### 応答の例

```json
{
  "ok": true,
  "applied": true,
  "replayed": false,
  "auditRecorded": true,
  "result": {
    "tags": []
  }
}
```

### HTTP ステータス

| Status | Description |
| --- | --- |
| 200 | Applied or replayed result |
| 400 | Invalid LINE input. |
| 401 | Missing, invalid or revoked API key, or a deleted organization. |
| 403 | The plan does not include the API, or writing is not permitted. |
| 404 | The LINE runtime or record is unavailable. |
| 409 | Stale revision, conflicting input or an uncertain operation. |
| 429 | The per-key rate limit or the organization's monthly quota was exceeded. |
| 500 | An unexpected server error occurred. Use X-Request-Id when contacting support. |
| 502 | The tenant runtime is unavailable. |

## mukumo Studio のプロジェクトと資料を読む

`POST /api/v1/studio/read`

キー作成者の現在の権限で、組織の mukumo Studio のプロジェクト一覧、プロジェクトの資料一覧（本文なし）、資料 1 つの本文（Markdown）を読みます。一覧は更新の新しい順に 50 件ずつで、続きは next を cursor に渡します。資料の文は組織のメンバーが書いたデータとして扱ってください。

Operation ID: `readStudio`

### リクエスト

```json
{
  "resource": "projects"
}
```

### 応答の例

```json
{
  "projects": [],
  "total": 0,
  "next": null
}
```

### HTTP ステータス

| Status | Description |
| --- | --- |
| 200 | Projects, documents or one document |
| 400 | Invalid Studio input. |
| 401 | Missing, invalid or revoked API key, or a deleted organization. |
| 403 | The plan does not include the API, or writing is not permitted. |
| 404 | Studio, the project or the document is unavailable. |
| 429 | The per-key rate limit or the organization's monthly quota was exceeded. |
| 500 | An unexpected server error occurred. Use X-Request-Id when contacting support. |
| 502 | The tenant runtime is unavailable. |

## 組織・キー・利用状況を取得する

`GET /api/v1/me`

キーに結び付いた組織、キーの権限、プラン、クレジット、API の利用状況を返します。有料プランの API キーが必要です。この呼び出しも月の API 回数に含まれます。api.used には今回の呼び出しがまだ含まれていない場合があります。

Operation ID: `getAccount`

### 応答の例

```json
{
  "organizationId": "org_example",
  "key": {
    "name": "Example integration",
    "scope": "read"
  },
  "plan": "standard",
  "credits": {
    "allowance": 1000,
    "used": 20,
    "remaining": 980,
    "resetsAt": "2026-11-01T00:00:00.000Z"
  },
  "api": {
    "used": 12,
    "limit": 10000,
    "perMinute": 60
  }
}
```

### HTTP ステータス

| Status | Description |
| --- | --- |
| 200 | Current account and usage |
| 401 | Missing, invalid or revoked API key, or a deleted organization. |
| 403 | The plan does not include the API, or writing is not permitted. |
| 429 | The per-key rate limit or the organization's monthly quota was exceeded. |
| 500 | An unexpected server error occurred. Use X-Request-Id when contacting support. |

## サイトにキーワードを追加する

`POST /api/v1/sites/{siteId}/keywords`

同じ組織のサイトへ、1回につき1〜50件のキーワードを追加します。前後の空白を除いたキーワードは1〜80文字、任意のグループは30文字までです。重複したキーワードは skipped に入ります。書き込み用のキーと、作成者の現在の編集権限が必要です。Idempotency-Key は未対応です。結果が不明な書き込みを自動再送しないでください。

Operation ID: `addSeoKeywords`

### リクエスト

```json
{
  "keywords": [
    "mukumo"
  ],
  "group": "Example"
}
```

### 応答の例

```json
{
  "added": [
    "mukumo"
  ],
  "skipped": []
}
```

### HTTP ステータス

| Status | Description |
| --- | --- |
| 201 | Added keywords and skipped duplicates |
| 400 | Invalid input or the site/plan keyword limit was exceeded. |
| 401 | Missing, invalid or revoked API key, or a deleted organization. |
| 403 | The plan does not include the API, or writing is not permitted. |
| 404 | The site does not exist in the API key's organization. |
| 429 | The per-key rate limit or the organization's monthly quota was exceeded. |
| 500 | An unexpected server error occurred. Use X-Request-Id when contacting support. |

## 型の定義

必須・任意の項目と詳細な型は以下の定義を参照してください。入力の文字数制限は前後の空白を除いた値に適用されます。

### LineReadResult

```json
{
  "type": "object",
  "additionalProperties": {}
}
```

### ApiError

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "message"
  ]
}
```

### LineReadInput

```json
{
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "resource": {
          "type": "string",
          "enum": [
            "accounts"
          ]
        }
      },
      "required": [
        "resource"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "resource": {
          "type": "string",
          "enum": [
            "tags",
            "templates",
            "auto-replies",
            "scenarios",
            "forms",
            "rich-menus",
            "links",
            "routes",
            "broadcasts"
          ]
        },
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "offset": {
          "type": "integer",
          "minimum": 0,
          "maximum": 1000000
        },
        "limit": {
          "type": "integer",
          "minimum": 1,
          "maximum": 50
        }
      },
      "required": [
        "resource"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "resource": {
          "type": "string",
          "enum": [
            "friends"
          ]
        },
        "accountId": {
          "type": "string",
          "format": "uuid"
        },
        "userId": {
          "type": "string",
          "pattern": "^U[0-9a-f]{32}$"
        },
        "search": {
          "type": "string",
          "maxLength": 100
        },
        "offset": {
          "type": "integer",
          "minimum": 0,
          "maximum": 1000000
        },
        "limit": {
          "type": "integer",
          "minimum": 1,
          "maximum": 50
        }
      },
      "required": [
        "resource"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "resource": {
          "type": "string",
          "enum": [
            "conversations"
          ]
        },
        "accountId": {
          "type": "string",
          "format": "uuid"
        }
      },
      "required": [
        "resource"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "resource": {
          "type": "string",
          "enum": [
            "messages"
          ]
        },
        "accountId": {
          "type": "string",
          "format": "uuid"
        },
        "userId": {
          "type": "string",
          "pattern": "^U[0-9a-f]{32}$"
        },
        "limit": {
          "type": "integer",
          "minimum": 1,
          "maximum": 50
        }
      },
      "required": [
        "resource",
        "accountId",
        "userId"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "resource": {
          "type": "string",
          "enum": [
            "form-submissions"
          ]
        },
        "id": {
          "type": "string",
          "format": "uuid"
        }
      },
      "required": [
        "resource",
        "id"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "resource": {
          "type": "string",
          "enum": [
            "friend-automations"
          ]
        },
        "accountId": {
          "type": "string",
          "format": "uuid"
        },
        "userId": {
          "type": "string",
          "pattern": "^U[0-9a-f]{32}$"
        }
      },
      "required": [
        "resource",
        "accountId",
        "userId"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "resource": {
          "type": "string",
          "enum": [
            "link-clicks"
          ]
        },
        "id": {
          "type": "string",
          "format": "uuid"
        }
      },
      "required": [
        "resource",
        "id"
      ],
      "additionalProperties": false
    }
  ]
}
```

### LineChangeResult

```json
{
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean",
      "enum": [
        true
      ]
    },
    "applied": {
      "type": "boolean"
    },
    "replayed": {
      "type": "boolean"
    },
    "auditRecorded": {
      "type": "boolean"
    },
    "result": {}
  },
  "required": [
    "ok",
    "applied",
    "replayed",
    "auditRecorded"
  ],
  "additionalProperties": false
}
```

### LineOperationInput

```json
{
  "type": "object",
  "properties": {
    "operationId": {
      "type": "string",
      "format": "uuid"
    },
    "change": {
      "$ref": "#/components/schemas/LineChangeInput"
    }
  },
  "required": [
    "operationId",
    "change"
  ],
  "additionalProperties": false
}
```

### LineChangeInput

```json
{
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "create-tags"
          ]
        },
        "data": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "color": {
              "type": "string",
              "enum": [
                "neutral",
                "blue",
                "purple",
                "brown",
                "pink",
                "orange",
                "green"
              ]
            }
          },
          "required": [
            "name",
            "color"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "action",
        "data"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "update-tags"
          ]
        },
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "expectedRevision": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "expectedLabel": {
          "type": "string",
          "maxLength": 200
        },
        "data": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "color": {
              "type": "string",
              "enum": [
                "neutral",
                "blue",
                "purple",
                "brown",
                "pink",
                "orange",
                "green"
              ]
            }
          },
          "required": [
            "name",
            "color"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "action",
        "id",
        "expectedRevision",
        "expectedLabel",
        "data"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "create-templates"
          ]
        },
        "data": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "text": {
              "type": "string",
              "minLength": 1,
              "maxLength": 5000
            }
          },
          "required": [
            "name",
            "text"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "action",
        "data"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "update-templates"
          ]
        },
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "expectedRevision": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "expectedLabel": {
          "type": "string",
          "maxLength": 200
        },
        "data": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "text": {
              "type": "string",
              "minLength": 1,
              "maxLength": 5000
            }
          },
          "required": [
            "name",
            "text"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "action",
        "id",
        "expectedRevision",
        "expectedLabel",
        "data"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "create-auto-replies"
          ]
        },
        "data": {
          "type": "object",
          "properties": {
            "accountId": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "keyword": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "matchType": {
              "type": "string",
              "enum": [
                "contains",
                "exact"
              ]
            },
            "responseText": {
              "type": "string",
              "minLength": 1,
              "maxLength": 5000
            },
            "content": {
              "type": "array",
              "items": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "text"
                        ]
                      },
                      "text": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 5000
                      }
                    },
                    "required": [
                      "type",
                      "text"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "image"
                        ]
                      },
                      "imageId": {
                        "type": "string",
                        "format": "uuid"
                      }
                    },
                    "required": [
                      "type",
                      "imageId"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "card"
                        ]
                      },
                      "altText": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 400
                      },
                      "color": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "pattern": "^#[0-9a-f]{6}$/i"
                      },
                      "cards": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "imageId": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "uuid"
                            },
                            "title": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 40
                            },
                            "text": {
                              "type": "string",
                              "maxLength": 300
                            },
                            "buttons": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "label": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 20
                                  },
                                  "action": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "enum": [
                                              "uri"
                                            ]
                                          },
                                          "uri": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 1000,
                                            "pattern": "^(?:(?:https?:\\/\\/|line:\\/\\/|tel:)\\S+|\\{link:[0-9a-f-]{36}\\}|\\{miniapp:\\/[A-Za-z0-9/_-]{0,100}\\})$"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "uri"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "enum": [
                                              "message"
                                            ]
                                          },
                                          "text": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 300
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "text"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "label",
                                  "action"
                                ],
                                "additionalProperties": false
                              },
                              "maxItems": 3
                            }
                          },
                          "required": [
                            "imageId",
                            "title",
                            "text",
                            "buttons"
                          ],
                          "additionalProperties": false
                        },
                        "minItems": 1,
                        "maxItems": 10
                      }
                    },
                    "required": [
                      "type",
                      "altText",
                      "color",
                      "cards"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "minItems": 1,
              "maxItems": 5
            },
            "active": {
              "type": "boolean"
            }
          },
          "required": [
            "accountId",
            "keyword",
            "matchType",
            "responseText",
            "active"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "action",
        "data"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "update-auto-replies"
          ]
        },
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "expectedRevision": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "expectedLabel": {
          "type": "string",
          "maxLength": 200
        },
        "data": {
          "type": "object",
          "properties": {
            "accountId": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "keyword": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "matchType": {
              "type": "string",
              "enum": [
                "contains",
                "exact"
              ]
            },
            "responseText": {
              "type": "string",
              "minLength": 1,
              "maxLength": 5000
            },
            "content": {
              "type": "array",
              "items": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "text"
                        ]
                      },
                      "text": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 5000
                      }
                    },
                    "required": [
                      "type",
                      "text"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "image"
                        ]
                      },
                      "imageId": {
                        "type": "string",
                        "format": "uuid"
                      }
                    },
                    "required": [
                      "type",
                      "imageId"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "card"
                        ]
                      },
                      "altText": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 400
                      },
                      "color": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "pattern": "^#[0-9a-f]{6}$/i"
                      },
                      "cards": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "imageId": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "uuid"
                            },
                            "title": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 40
                            },
                            "text": {
                              "type": "string",
                              "maxLength": 300
                            },
                            "buttons": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "label": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 20
                                  },
                                  "action": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "enum": [
                                              "uri"
                                            ]
                                          },
                                          "uri": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 1000,
                                            "pattern": "^(?:(?:https?:\\/\\/|line:\\/\\/|tel:)\\S+|\\{link:[0-9a-f-]{36}\\}|\\{miniapp:\\/[A-Za-z0-9/_-]{0,100}\\})$"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "uri"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "enum": [
                                              "message"
                                            ]
                                          },
                                          "text": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 300
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "text"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "label",
                                  "action"
                                ],
                                "additionalProperties": false
                              },
                              "maxItems": 3
                            }
                          },
                          "required": [
                            "imageId",
                            "title",
                            "text",
                            "buttons"
                          ],
                          "additionalProperties": false
                        },
                        "minItems": 1,
                        "maxItems": 10
                      }
                    },
                    "required": [
                      "type",
                      "altText",
                      "color",
                      "cards"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "minItems": 1,
              "maxItems": 5
            },
            "active": {
              "type": "boolean"
            }
          },
          "required": [
            "accountId",
            "keyword",
            "matchType",
            "responseText",
            "active"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "action",
        "id",
        "expectedRevision",
        "expectedLabel",
        "data"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "create-scenarios"
          ]
        },
        "data": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "accountId": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "trigger": {
              "type": "string",
              "enum": [
                "follow",
                "tag",
                "manual"
              ]
            },
            "triggerTagId": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "active": {
              "type": "boolean"
            },
            "steps": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "delayValue": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 525600
                  },
                  "delayUnit": {
                    "type": "string",
                    "enum": [
                      "minutes",
                      "hours",
                      "days"
                    ]
                  },
                  "sendTime": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
                  },
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 5000
                  },
                  "content": {
                    "type": "array",
                    "items": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "text"
                              ]
                            },
                            "text": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 5000
                            }
                          },
                          "required": [
                            "type",
                            "text"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "image"
                              ]
                            },
                            "imageId": {
                              "type": "string",
                              "format": "uuid"
                            }
                          },
                          "required": [
                            "type",
                            "imageId"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "card"
                              ]
                            },
                            "altText": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 400
                            },
                            "color": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "pattern": "^#[0-9a-f]{6}$/i"
                            },
                            "cards": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "imageId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "uuid"
                                  },
                                  "title": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 40
                                  },
                                  "text": {
                                    "type": "string",
                                    "maxLength": 300
                                  },
                                  "buttons": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "label": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 20
                                        },
                                        "action": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "uri"
                                                  ]
                                                },
                                                "uri": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 1000,
                                                  "pattern": "^(?:(?:https?:\\/\\/|line:\\/\\/|tel:)\\S+|\\{link:[0-9a-f-]{36}\\}|\\{miniapp:\\/[A-Za-z0-9/_-]{0,100}\\})$"
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "uri"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "message"
                                                  ]
                                                },
                                                "text": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 300
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "text"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ]
                                        }
                                      },
                                      "required": [
                                        "label",
                                        "action"
                                      ],
                                      "additionalProperties": false
                                    },
                                    "maxItems": 3
                                  }
                                },
                                "required": [
                                  "imageId",
                                  "title",
                                  "text",
                                  "buttons"
                                ],
                                "additionalProperties": false
                              },
                              "minItems": 1,
                              "maxItems": 10
                            }
                          },
                          "required": [
                            "type",
                            "altText",
                            "color",
                            "cards"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "minItems": 1,
                    "maxItems": 5
                  },
                  "timingMode": {
                    "type": "string",
                    "enum": [
                      "relative",
                      "elapsed",
                      "absolute_time"
                    ]
                  },
                  "condition": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "tag_exists",
                              "tag_not_exists"
                            ]
                          },
                          "tagId": {
                            "type": "string",
                            "format": "uuid"
                          }
                        },
                        "required": [
                          "type",
                          "tagId"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "metadata_equals",
                              "metadata_not_equals"
                            ]
                          },
                          "key": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100
                          },
                          "value": {
                            "type": "string",
                            "maxLength": 1000
                          }
                        },
                        "required": [
                          "type",
                          "key",
                          "value"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "nextStepOnFalse": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 19
                  }
                },
                "required": [
                  "delayValue",
                  "delayUnit",
                  "sendTime",
                  "text"
                ],
                "additionalProperties": false
              },
              "minItems": 1,
              "maxItems": 20
            }
          },
          "required": [
            "name",
            "accountId",
            "trigger",
            "triggerTagId",
            "active",
            "steps"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "action",
        "data"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "update-scenarios"
          ]
        },
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "expectedRevision": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "expectedLabel": {
          "type": "string",
          "maxLength": 200
        },
        "data": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "accountId": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "trigger": {
              "type": "string",
              "enum": [
                "follow",
                "tag",
                "manual"
              ]
            },
            "triggerTagId": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "active": {
              "type": "boolean"
            },
            "steps": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "delayValue": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 525600
                  },
                  "delayUnit": {
                    "type": "string",
                    "enum": [
                      "minutes",
                      "hours",
                      "days"
                    ]
                  },
                  "sendTime": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
                  },
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 5000
                  },
                  "content": {
                    "type": "array",
                    "items": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "text"
                              ]
                            },
                            "text": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 5000
                            }
                          },
                          "required": [
                            "type",
                            "text"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "image"
                              ]
                            },
                            "imageId": {
                              "type": "string",
                              "format": "uuid"
                            }
                          },
                          "required": [
                            "type",
                            "imageId"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "card"
                              ]
                            },
                            "altText": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 400
                            },
                            "color": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "pattern": "^#[0-9a-f]{6}$/i"
                            },
                            "cards": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "imageId": {
                                    "type": [
                                      "string",
                                      "null"
                                    ],
                                    "format": "uuid"
                                  },
                                  "title": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 40
                                  },
                                  "text": {
                                    "type": "string",
                                    "maxLength": 300
                                  },
                                  "buttons": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "label": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 20
                                        },
                                        "action": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "uri"
                                                  ]
                                                },
                                                "uri": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 1000,
                                                  "pattern": "^(?:(?:https?:\\/\\/|line:\\/\\/|tel:)\\S+|\\{link:[0-9a-f-]{36}\\}|\\{miniapp:\\/[A-Za-z0-9/_-]{0,100}\\})$"
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "uri"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "enum": [
                                                    "message"
                                                  ]
                                                },
                                                "text": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 300
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "text"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ]
                                        }
                                      },
                                      "required": [
                                        "label",
                                        "action"
                                      ],
                                      "additionalProperties": false
                                    },
                                    "maxItems": 3
                                  }
                                },
                                "required": [
                                  "imageId",
                                  "title",
                                  "text",
                                  "buttons"
                                ],
                                "additionalProperties": false
                              },
                              "minItems": 1,
                              "maxItems": 10
                            }
                          },
                          "required": [
                            "type",
                            "altText",
                            "color",
                            "cards"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "minItems": 1,
                    "maxItems": 5
                  },
                  "timingMode": {
                    "type": "string",
                    "enum": [
                      "relative",
                      "elapsed",
                      "absolute_time"
                    ]
                  },
                  "condition": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "tag_exists",
                              "tag_not_exists"
                            ]
                          },
                          "tagId": {
                            "type": "string",
                            "format": "uuid"
                          }
                        },
                        "required": [
                          "type",
                          "tagId"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "metadata_equals",
                              "metadata_not_equals"
                            ]
                          },
                          "key": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100
                          },
                          "value": {
                            "type": "string",
                            "maxLength": 1000
                          }
                        },
                        "required": [
                          "type",
                          "key",
                          "value"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "nextStepOnFalse": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 19
                  }
                },
                "required": [
                  "delayValue",
                  "delayUnit",
                  "sendTime",
                  "text"
                ],
                "additionalProperties": false
              },
              "minItems": 1,
              "maxItems": 20
            }
          },
          "required": [
            "name",
            "accountId",
            "trigger",
            "triggerTagId",
            "active",
            "steps"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "action",
        "id",
        "expectedRevision",
        "expectedLabel",
        "data"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "create-forms"
          ]
        },
        "data": {
          "type": "object",
          "properties": {
            "accountId": {
              "type": "string",
              "format": "uuid"
            },
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "title": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "description": {
              "type": "string",
              "maxLength": 1000
            },
            "fields": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9_]{0,39}$"
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "text",
                      "textarea",
                      "email",
                      "tel",
                      "number",
                      "select",
                      "radio",
                      "checkbox",
                      "date"
                    ]
                  },
                  "required": {
                    "type": "boolean"
                  },
                  "options": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "maxItems": 30
                  },
                  "placeholder": {
                    "type": "string",
                    "maxLength": 100
                  }
                },
                "required": [
                  "key",
                  "label",
                  "type",
                  "required",
                  "options",
                  "placeholder"
                ],
                "additionalProperties": false
              },
              "minItems": 1,
              "maxItems": 30
            },
            "submitTagId": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "submitScenarioId": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "saveToProfile": {
              "type": "boolean"
            },
            "thanksText": {
              "type": "string",
              "maxLength": 5000
            },
            "active": {
              "type": "boolean"
            }
          },
          "required": [
            "accountId",
            "name",
            "title",
            "description",
            "fields",
            "submitTagId",
            "submitScenarioId",
            "saveToProfile",
            "thanksText",
            "active"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "action",
        "data"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "update-forms"
          ]
        },
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "expectedRevision": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "expectedLabel": {
          "type": "string",
          "maxLength": 200
        },
        "data": {
          "type": "object",
          "properties": {
            "accountId": {
              "type": "string",
              "format": "uuid"
            },
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "title": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "description": {
              "type": "string",
              "maxLength": 1000
            },
            "fields": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9_]{0,39}$"
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "text",
                      "textarea",
                      "email",
                      "tel",
                      "number",
                      "select",
                      "radio",
                      "checkbox",
                      "date"
                    ]
                  },
                  "required": {
                    "type": "boolean"
                  },
                  "options": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100
                    },
                    "maxItems": 30
                  },
                  "placeholder": {
                    "type": "string",
                    "maxLength": 100
                  }
                },
                "required": [
                  "key",
                  "label",
                  "type",
                  "required",
                  "options",
                  "placeholder"
                ],
                "additionalProperties": false
              },
              "minItems": 1,
              "maxItems": 30
            },
            "submitTagId": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "submitScenarioId": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "saveToProfile": {
              "type": "boolean"
            },
            "thanksText": {
              "type": "string",
              "maxLength": 5000
            },
            "active": {
              "type": "boolean"
            }
          },
          "required": [
            "accountId",
            "name",
            "title",
            "description",
            "fields",
            "submitTagId",
            "submitScenarioId",
            "saveToProfile",
            "thanksText",
            "active"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "action",
        "id",
        "expectedRevision",
        "expectedLabel",
        "data"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "create-rich-menus"
          ]
        },
        "data": {
          "type": "object",
          "properties": {
            "accountId": {
              "type": "string",
              "format": "uuid"
            },
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "chatBarText": {
              "type": "string",
              "minLength": 1,
              "maxLength": 14
            },
            "size": {
              "type": "string",
              "enum": [
                "large",
                "compact"
              ]
            },
            "template": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "areas": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "x": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "y": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "width": {
                    "type": "integer",
                    "exclusiveMinimum": 0
                  },
                  "height": {
                    "type": "integer",
                    "exclusiveMinimum": 0
                  },
                  "action": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "uri"
                            ]
                          },
                          "uri": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1000,
                            "pattern": "^(?:(?:https?:\\/\\/|line:\\/\\/|tel:)\\S+|\\{link:[0-9a-f-]{36}\\}|\\{miniapp:\\/[A-Za-z0-9/_-]{0,100}\\})$"
                          },
                          "label": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 20
                          }
                        },
                        "required": [
                          "type",
                          "uri",
                          "label"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "message"
                            ]
                          },
                          "text": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 300
                          },
                          "label": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 20
                          }
                        },
                        "required": [
                          "type",
                          "text",
                          "label"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "switch"
                            ]
                          },
                          "menuId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "label": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 20
                          }
                        },
                        "required": [
                          "type",
                          "menuId",
                          "label"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "required": [
                  "x",
                  "y",
                  "width",
                  "height",
                  "action"
                ],
                "additionalProperties": false
              },
              "minItems": 1,
              "maxItems": 20
            },
            "design": {
              "type": [
                "object",
                "null"
              ],
              "properties": {
                "style": {
                  "type": "string",
                  "enum": [
                    "tiles",
                    "cards",
                    "bold"
                  ]
                },
                "color": {
                  "type": "string",
                  "pattern": "^#[0-9a-f]{6}$/i"
                },
                "areas": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "icon": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 100
                      },
                      "caption": {
                        "type": "string",
                        "maxLength": 30
                      }
                    },
                    "required": [
                      "icon",
                      "caption"
                    ],
                    "additionalProperties": false
                  },
                  "maxItems": 20
                }
              },
              "required": [
                "style",
                "color",
                "areas"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "accountId",
            "name",
            "chatBarText",
            "size",
            "template",
            "areas"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "action",
        "data"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "update-rich-menus"
          ]
        },
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "expectedRevision": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "expectedLabel": {
          "type": "string",
          "maxLength": 200
        },
        "data": {
          "type": "object",
          "properties": {
            "accountId": {
              "type": "string",
              "format": "uuid"
            },
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "chatBarText": {
              "type": "string",
              "minLength": 1,
              "maxLength": 14
            },
            "size": {
              "type": "string",
              "enum": [
                "large",
                "compact"
              ]
            },
            "template": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "areas": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "x": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "y": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "width": {
                    "type": "integer",
                    "exclusiveMinimum": 0
                  },
                  "height": {
                    "type": "integer",
                    "exclusiveMinimum": 0
                  },
                  "action": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "uri"
                            ]
                          },
                          "uri": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1000,
                            "pattern": "^(?:(?:https?:\\/\\/|line:\\/\\/|tel:)\\S+|\\{link:[0-9a-f-]{36}\\}|\\{miniapp:\\/[A-Za-z0-9/_-]{0,100}\\})$"
                          },
                          "label": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 20
                          }
                        },
                        "required": [
                          "type",
                          "uri",
                          "label"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "message"
                            ]
                          },
                          "text": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 300
                          },
                          "label": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 20
                          }
                        },
                        "required": [
                          "type",
                          "text",
                          "label"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "switch"
                            ]
                          },
                          "menuId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "label": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 20
                          }
                        },
                        "required": [
                          "type",
                          "menuId",
                          "label"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "required": [
                  "x",
                  "y",
                  "width",
                  "height",
                  "action"
                ],
                "additionalProperties": false
              },
              "minItems": 1,
              "maxItems": 20
            },
            "design": {
              "type": [
                "object",
                "null"
              ],
              "properties": {
                "style": {
                  "type": "string",
                  "enum": [
                    "tiles",
                    "cards",
                    "bold"
                  ]
                },
                "color": {
                  "type": "string",
                  "pattern": "^#[0-9a-f]{6}$/i"
                },
                "areas": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "icon": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 100
                      },
                      "caption": {
                        "type": "string",
                        "maxLength": 30
                      }
                    },
                    "required": [
                      "icon",
                      "caption"
                    ],
                    "additionalProperties": false
                  },
                  "maxItems": 20
                }
              },
              "required": [
                "style",
                "color",
                "areas"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "accountId",
            "name",
            "chatBarText",
            "size",
            "template",
            "areas"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "action",
        "id",
        "expectedRevision",
        "expectedLabel",
        "data"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "create-links"
          ]
        },
        "data": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "url": {
              "type": "string",
              "maxLength": 2000,
              "pattern": "^https?:\\/\\/"
            },
            "tagId": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "scenarioId": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            }
          },
          "required": [
            "name",
            "url",
            "tagId",
            "scenarioId"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "action",
        "data"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "update-links"
          ]
        },
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "expectedRevision": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "expectedLabel": {
          "type": "string",
          "maxLength": 200
        },
        "data": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "url": {
              "type": "string",
              "maxLength": 2000,
              "pattern": "^https?:\\/\\/"
            },
            "tagId": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "scenarioId": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            }
          },
          "required": [
            "name",
            "url",
            "tagId",
            "scenarioId"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "action",
        "id",
        "expectedRevision",
        "expectedLabel",
        "data"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "create-routes"
          ]
        },
        "data": {
          "type": "object",
          "properties": {
            "accountId": {
              "type": "string",
              "format": "uuid"
            },
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "tagId": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "scenarioId": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            }
          },
          "required": [
            "accountId",
            "name",
            "tagId",
            "scenarioId"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "action",
        "data"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "update-routes"
          ]
        },
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "expectedRevision": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "expectedLabel": {
          "type": "string",
          "maxLength": 200
        },
        "data": {
          "type": "object",
          "properties": {
            "accountId": {
              "type": "string",
              "format": "uuid"
            },
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "tagId": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            },
            "scenarioId": {
              "type": [
                "string",
                "null"
              ],
              "format": "uuid"
            }
          },
          "required": [
            "accountId",
            "name",
            "tagId",
            "scenarioId"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "action",
        "id",
        "expectedRevision",
        "expectedLabel",
        "data"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "create-broadcasts"
          ]
        },
        "data": {
          "type": "object",
          "properties": {
            "accountId": {
              "type": "string",
              "format": "uuid"
            },
            "title": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "messages": {
              "type": "array",
              "items": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "text"
                        ]
                      },
                      "text": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 5000
                      }
                    },
                    "required": [
                      "type",
                      "text"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "image"
                        ]
                      },
                      "imageId": {
                        "type": "string",
                        "format": "uuid"
                      }
                    },
                    "required": [
                      "type",
                      "imageId"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "card"
                        ]
                      },
                      "altText": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 400
                      },
                      "color": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "pattern": "^#[0-9a-f]{6}$/i"
                      },
                      "cards": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "imageId": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "uuid"
                            },
                            "title": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 40
                            },
                            "text": {
                              "type": "string",
                              "maxLength": 300
                            },
                            "buttons": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "label": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 20
                                  },
                                  "action": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "enum": [
                                              "uri"
                                            ]
                                          },
                                          "uri": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 1000,
                                            "pattern": "^(?:(?:https?:\\/\\/|line:\\/\\/|tel:)\\S+|\\{link:[0-9a-f-]{36}\\}|\\{miniapp:\\/[A-Za-z0-9/_-]{0,100}\\})$"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "uri"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "enum": [
                                              "message"
                                            ]
                                          },
                                          "text": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 300
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "text"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "label",
                                  "action"
                                ],
                                "additionalProperties": false
                              },
                              "maxItems": 3
                            }
                          },
                          "required": [
                            "imageId",
                            "title",
                            "text",
                            "buttons"
                          ],
                          "additionalProperties": false
                        },
                        "minItems": 1,
                        "maxItems": 10
                      }
                    },
                    "required": [
                      "type",
                      "altText",
                      "color",
                      "cards"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "minItems": 1,
              "maxItems": 5
            },
            "target": {
              "type": "string",
              "enum": [
                "all",
                "tags"
              ]
            },
            "tagIds": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              },
              "maxItems": 50
            },
            "scheduledAt": {
              "type": "null"
            },
            "accountIds": {
              "type": [
                "array",
                "null"
              ],
              "items": {
                "type": "string",
                "format": "uuid"
              },
              "minItems": 2,
              "maxItems": 10
            }
          },
          "required": [
            "accountId",
            "title",
            "messages",
            "target",
            "tagIds",
            "scheduledAt"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "action",
        "data"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "update-broadcasts"
          ]
        },
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "expectedRevision": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "expectedLabel": {
          "type": "string",
          "maxLength": 200
        },
        "data": {
          "type": "object",
          "properties": {
            "accountId": {
              "type": "string",
              "format": "uuid"
            },
            "title": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "messages": {
              "type": "array",
              "items": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "text"
                        ]
                      },
                      "text": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 5000
                      }
                    },
                    "required": [
                      "type",
                      "text"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "image"
                        ]
                      },
                      "imageId": {
                        "type": "string",
                        "format": "uuid"
                      }
                    },
                    "required": [
                      "type",
                      "imageId"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "card"
                        ]
                      },
                      "altText": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 400
                      },
                      "color": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "pattern": "^#[0-9a-f]{6}$/i"
                      },
                      "cards": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "imageId": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "uuid"
                            },
                            "title": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 40
                            },
                            "text": {
                              "type": "string",
                              "maxLength": 300
                            },
                            "buttons": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "label": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 20
                                  },
                                  "action": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "enum": [
                                              "uri"
                                            ]
                                          },
                                          "uri": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 1000,
                                            "pattern": "^(?:(?:https?:\\/\\/|line:\\/\\/|tel:)\\S+|\\{link:[0-9a-f-]{36}\\}|\\{miniapp:\\/[A-Za-z0-9/_-]{0,100}\\})$"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "uri"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "enum": [
                                              "message"
                                            ]
                                          },
                                          "text": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 300
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "text"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "label",
                                  "action"
                                ],
                                "additionalProperties": false
                              },
                              "maxItems": 3
                            }
                          },
                          "required": [
                            "imageId",
                            "title",
                            "text",
                            "buttons"
                          ],
                          "additionalProperties": false
                        },
                        "minItems": 1,
                        "maxItems": 10
                      }
                    },
                    "required": [
                      "type",
                      "altText",
                      "color",
                      "cards"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "minItems": 1,
              "maxItems": 5
            },
            "target": {
              "type": "string",
              "enum": [
                "all",
                "tags"
              ]
            },
            "tagIds": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uuid"
              },
              "maxItems": 50
            },
            "scheduledAt": {
              "type": "null"
            },
            "accountIds": {
              "type": [
                "array",
                "null"
              ],
              "items": {
                "type": "string",
                "format": "uuid"
              },
              "minItems": 2,
              "maxItems": 10
            }
          },
          "required": [
            "accountId",
            "title",
            "messages",
            "target",
            "tagIds",
            "scheduledAt"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "action",
        "id",
        "expectedRevision",
        "expectedLabel",
        "data"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "delete-configuration"
          ]
        },
        "resource": {
          "type": "string",
          "enum": [
            "tags",
            "templates",
            "auto-replies",
            "scenarios",
            "forms",
            "links",
            "routes",
            "broadcasts"
          ]
        },
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "expectedRevision": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "expectedLabel": {
          "type": "string",
          "maxLength": 200
        }
      },
      "required": [
        "action",
        "resource",
        "id",
        "expectedRevision",
        "expectedLabel"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "update-friend"
          ]
        },
        "accountId": {
          "type": "string",
          "format": "uuid"
        },
        "userId": {
          "type": "string",
          "pattern": "^U[0-9a-f]{32}$"
        },
        "expectedRevision": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "expectedLabel": {
          "type": "string",
          "maxLength": 200
        },
        "data": {
          "type": "object",
          "properties": {
            "notes": {
              "type": [
                "string",
                "null"
              ],
              "maxLength": 2000
            },
            "status": {
              "type": "string",
              "enum": [
                "unread",
                "in_progress",
                "resolved"
              ]
            }
          },
          "additionalProperties": false
        }
      },
      "required": [
        "action",
        "accountId",
        "userId",
        "expectedRevision",
        "expectedLabel",
        "data"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "set-friend-tags"
          ]
        },
        "accountId": {
          "type": "string",
          "format": "uuid"
        },
        "userId": {
          "type": "string",
          "pattern": "^U[0-9a-f]{32}$"
        },
        "expectedRevision": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "expectedLabel": {
          "type": "string",
          "maxLength": 200
        },
        "tagIds": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uuid"
          },
          "maxItems": 50
        }
      },
      "required": [
        "action",
        "accountId",
        "userId",
        "expectedRevision",
        "expectedLabel",
        "tagIds"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "action": {
          "type": "string",
          "enum": [
            "enroll-scenario"
          ]
        },
        "accountId": {
          "type": "string",
          "format": "uuid"
        },
        "userId": {
          "type": "string",
          "pattern": "^U[0-9a-f]{32}$"
        },
        "scenarioId": {
          "type": "string",
          "format": "uuid"
        }
      },
      "required": [
        "action",
        "accountId",
        "userId",
        "scenarioId"
      ],
      "additionalProperties": false
    }
  ]
}
```

### StudioReadResult

```json
{
  "anyOf": [
    {
      "type": "object",
      "properties": {
        "projects": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/StudioProject"
          }
        },
        "total": {
          "type": [
            "integer",
            "null"
          ]
        },
        "next": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "projects",
        "total",
        "next"
      ]
    },
    {
      "type": "object",
      "properties": {
        "project": {
          "$ref": "#/components/schemas/StudioProject"
        },
        "documents": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/StudioDocumentSummary"
          }
        },
        "total": {
          "type": [
            "integer",
            "null"
          ]
        },
        "next": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "project",
        "documents",
        "total",
        "next"
      ]
    },
    {
      "type": "object",
      "properties": {
        "project": {
          "$ref": "#/components/schemas/StudioProject"
        },
        "document": {
          "$ref": "#/components/schemas/StudioDocument"
        }
      },
      "required": [
        "project",
        "document"
      ]
    }
  ]
}
```

### StudioProject

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "archived": {
      "type": "boolean"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "id",
    "name",
    "description",
    "archived",
    "updatedAt"
  ]
}
```

### StudioDocumentSummary

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "title": {
      "type": "string"
    },
    "kind": {
      "type": "string",
      "enum": [
        "specification",
        "brand",
        "component",
        "note"
      ]
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "id",
    "title",
    "kind",
    "updatedAt"
  ]
}
```

### StudioDocument

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "title": {
      "type": "string"
    },
    "kind": {
      "type": "string",
      "enum": [
        "specification",
        "brand",
        "component",
        "note"
      ]
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "body": {
      "type": "string"
    }
  },
  "required": [
    "id",
    "title",
    "kind",
    "updatedAt",
    "body"
  ]
}
```

### StudioReadInput

```json
{
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "resource": {
          "type": "string",
          "enum": [
            "projects"
          ]
        },
        "query": {
          "type": "string",
          "maxLength": 100
        },
        "archived": {
          "type": "boolean"
        },
        "cursor": {
          "type": "string",
          "maxLength": 80
        }
      },
      "required": [
        "resource"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "resource": {
          "type": "string",
          "enum": [
            "documents"
          ]
        },
        "projectId": {
          "type": "string",
          "format": "uuid"
        },
        "query": {
          "type": "string",
          "maxLength": 100
        },
        "kind": {
          "type": "string",
          "enum": [
            "specification",
            "brand",
            "component",
            "note"
          ]
        },
        "cursor": {
          "type": "string",
          "maxLength": 80
        }
      },
      "required": [
        "resource",
        "projectId"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "resource": {
          "type": "string",
          "enum": [
            "document"
          ]
        },
        "projectId": {
          "type": "string",
          "format": "uuid"
        },
        "documentId": {
          "type": "string",
          "format": "uuid"
        }
      },
      "required": [
        "resource",
        "projectId",
        "documentId"
      ],
      "additionalProperties": false
    }
  ]
}
```

### Account

```json
{
  "type": "object",
  "properties": {
    "organizationId": {
      "type": "string"
    },
    "key": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "scope": {
          "type": "string",
          "enum": [
            "read",
            "write"
          ]
        }
      },
      "required": [
        "name",
        "scope"
      ]
    },
    "plan": {
      "type": "string"
    },
    "credits": {
      "type": "object",
      "properties": {
        "allowance": {
          "type": "number"
        },
        "used": {
          "type": "number"
        },
        "remaining": {
          "type": "number"
        },
        "resetsAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "allowance",
        "used",
        "remaining",
        "resetsAt"
      ]
    },
    "api": {
      "type": "object",
      "properties": {
        "used": {
          "type": "number"
        },
        "limit": {
          "type": "number"
        },
        "perMinute": {
          "type": "number"
        }
      },
      "required": [
        "used",
        "limit",
        "perMinute"
      ]
    }
  },
  "required": [
    "organizationId",
    "key",
    "plan",
    "credits",
    "api"
  ]
}
```

### AddKeywordsResult

```json
{
  "type": "object",
  "properties": {
    "added": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "skipped": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "required": [
    "added",
    "skipped"
  ]
}
```

### AddKeywordsInput

```json
{
  "type": "object",
  "properties": {
    "keywords": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 80
      },
      "minItems": 1,
      "maxItems": 50
    },
    "group": {
      "type": "string",
      "maxLength": 30
    }
  },
  "required": [
    "keywords"
  ]
}
```

## エラーと再送

```json
{
  "error": "FORBIDDEN",
  "message": "このキーでは書き込めません。"
}
```

エラーでは HTTP ステータスと error を確認します。429 のすべてに Retry-After が付くわけではありません。書き込みの結果が不明な場合は、アプリで登録状態を確かめてから再実行してください。問い合わせには X-Request-Id を添えると、要求を特定できます。

仕様書の版: `0.1.0`。この番号は API の日付版ヘッダーではありません。
