{
  "openapi": "3.1.0",
  "info": {
    "title": "さざめきサーベイAPI",
    "version": "1.0.0",
    "description": "さざめきサーベイ（職場の匿名アンケート）の、この会社の締め切った回の集計を読む道具です。list_roundsで締め切った回の一覧、get_round_resultsで1つの回の集計（会社全体・部署・属性ごとの点数）を読みます。回答者の匿名が中心の約束です：出すのは、回答が会社の最小人数（5人以上）に届き、ほかのグループとの差し引きでも人数が足りるグループの数字だけです。自由記述・個人・回答の時刻・表示しないグループの人数は出しません。人数が少なめのグループ（coarse）は点を丸め、人数は幅で示します。受付中の回は読めません。読むだけで、書き込みはできません。提供時間は平日10:00〜18:00（日本時間）で、時間外は使えません。\n\n料金とプランは https://pulse.kamiforge.com/pricing.json（認証なし）にあります。無料トライアルはAPIだけでも申し込めます：POST https://pulse.kamiforge.com/api/v1/trialsにcompany_name・email・agree_terms・terms_versionを送ると、確認のメールが1通届きます。人がリンクを1回押したあと、GET https://pulse.kamiforge.com/api/v1/trials/{id}で読み取りのAPIキーを1回だけ受け取れます。MCPは https://pulse.kamiforge.com/mcp（OAuthのメタデータは https://pulse.kamiforge.com/.well-known/oauth-authorization-server）。案内のページ：https://pulse.kamiforge.com/developers"
  },
  "servers": [
    {
      "url": "https://pulse.kamiforge.com"
    }
  ],
  "paths": {
    "/api/v1/rounds": {
      "get": {
        "operationId": "list_rounds",
        "summary": "締め切った回の一覧",
        "description": "この会社の締め切った回（受付を終えたアンケート）を、古い順に返します。プランが結果の推移に残す回数までです。答えはrounds（id・題名・設問のセット・対象（all：全員、part：一部、onboarding・exit：入社後・退職前）・受付の始まりと締め切り・その回の最小人数min_group）です。",
        "security": [
          {
            "bearer": []
          }
        ],
        "x-scope": "read",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "エラー",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/rounds/{id}/results": {
      "get": {
        "operationId": "get_round_results",
        "summary": "1つの回の集計",
        "description": "締め切った回の集計を返します。groupsは会社全体（keyが空）と部署ごと、attributesは属性（職種・雇用形態など）ごとで、それぞれ回答数n、領域ごとの点（areas）、設問ごとの点（questions）です。匿名を守るため、回答が最小人数に届かないグループや、ほかのグループとの差し引きで人数が少なくなるグループは、はじめから入っていません（0件や空と同じではありません）。coarseがtrueのグループは点を丸め、人数は幅（nからn_band人）で示します。自由記述・個人の回答・回答の時刻は出しません。受付中の回や、見つからない回は404です。集計を止めている回（withheld）は、グループが空で、その理由を返します。",
        "security": [
          {
            "bearer": []
          }
        ],
        "x-scope": "read",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "エラー",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 36,
              "maxLength": 36,
              "description": "回のID（list_roundsのid）"
            }
          }
        ]
      }
    },
    "/pricing.json": {
      "servers": [
        {
          "url": "https://pulse.kamiforge.com"
        }
      ],
      "get": {
        "operationId": "getPricing",
        "summary": "プランと料金（機械で読める形。画面の料金と同じ表から作る）",
        "description": "プランごとの金額（税別と税込、画面がどちらで表示しているか）、単位（月・年・ドメインや人ごと）、上限、無料トライアル、解約の条件。キーは要らない。",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PricingDocument"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/trials": {
      "post": {
        "operationId": "start_trial",
        "summary": "無料トライアルを申し込む（キーは要りません）",
        "description": "会社名とメールアドレスで無料トライアルを申し込みます。人がすることは、届いたメールのリンクを開いて確認のボタンを押すことだけです。答えのpoll_tokenでGET /api/v1/trials/{id}を読むと、確認のあとに読み取りのAPIキーを1回だけ受け取れます。接続元ごとに1時間5回・1日20回までです。",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "company_name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "description": "会社名"
                  },
                  "email": {
                    "type": "string",
                    "maxLength": 254,
                    "description": "使い始める人のメールアドレス（確認のメールが届きます）"
                  },
                  "agree_terms": {
                    "type": "boolean",
                    "const": true,
                    "description": "利用規約とプライバシーポリシーへの同意（https://pulse.kamiforge.com/terms）"
                  },
                  "terms_version": {
                    "type": "string",
                    "description": "同意した利用規約の版（違えば409 terms_changedと、いまの版）"
                  },
                  "source": {
                    "type": "string",
                    "maxLength": 64,
                    "pattern": "^[A-Za-z0-9._-]+$",
                    "description": "任意。どこで知ったか（例：mcp-registry、search、teams）"
                  }
                },
                "required": [
                  "company_name",
                  "email",
                  "agree_terms",
                  "terms_version"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "受け付けました（確認のメールを送りました）"
          },
          "default": {
            "description": "エラー",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/trials/{id}": {
      "get": {
        "operationId": "get_trial",
        "summary": "トライアルのお申し込みの状態（確認のあと、APIキーを1回だけ）",
        "description": "Authorization: Bearer <poll_token>。statusはpending（確認待ち）、ready（api_keyを1回だけ）。渡したあとは409 already_delivered、24時間を過ぎると410 expired。1分12回まで。",
        "security": [
          {
            "bearer": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "状態"
          },
          "default": {
            "description": "エラー",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "APIキー、またはOAuthのアクセストークン"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "details": {
                "type": "object"
              }
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "PricingDocument": {
        "type": "object",
        "required": [
          "format",
          "service",
          "provider",
          "url",
          "currency",
          "tax",
          "plans",
          "cancellation",
          "terms_url",
          "legal_notice_url",
          "notes"
        ],
        "properties": {
          "format": {
            "type": "string",
            "const": "vaunt-pricing/1"
          },
          "service": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "currency": {
            "type": "string",
            "const": "JPY"
          },
          "tax": {
            "type": "object",
            "required": [
              "rate_percent",
              "note"
            ],
            "properties": {
              "rate_percent": {
                "type": "integer"
              },
              "note": {
                "type": "string"
              }
            }
          },
          "plans": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PricingPlan"
            }
          },
          "cancellation": {
            "$ref": "#/components/schemas/PricingCancellation"
          },
          "terms_url": {
            "type": "string"
          },
          "legal_notice_url": {
            "type": "string"
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "PricingPlan": {
        "type": "object",
        "required": [
          "id",
          "name",
          "available",
          "prices",
          "limits",
          "features",
          "trial",
          "note"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "audience": {
            "type": [
              "string",
              "null"
            ]
          },
          "available": {
            "type": "boolean",
            "description": "false: 表示はしているが、まだ申し込めない"
          },
          "prices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PricingPrice"
            }
          },
          "limits": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PricingLimit"
            }
          },
          "features": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "trial": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PricingTrial"
              },
              {
                "type": "null"
              }
            ]
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          },
          "note": {
            "type": "string"
          }
        }
      },
      "PricingPrice": {
        "type": "object",
        "required": [
          "amount_excluding_tax",
          "amount_including_tax",
          "shown_as",
          "period",
          "per",
          "included_quantity",
          "label",
          "examples"
        ],
        "properties": {
          "amount_excluding_tax": {
            "type": "integer",
            "description": "円、税別"
          },
          "amount_including_tax": {
            "type": "integer",
            "description": "円、税込（請求する額）"
          },
          "shown_as": {
            "type": "string",
            "enum": [
              "excluding_tax",
              "including_tax"
            ],
            "description": "画面が料金として出している方"
          },
          "period": {
            "type": "string",
            "enum": [
              "month",
              "year"
            ]
          },
          "per": {
            "description": "null：契約ごと。あれば、その単位ごと（included_quantityを超えた分）",
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "unit",
                  "label"
                ],
                "properties": {
                  "unit": {
                    "type": "string"
                  },
                  "label": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "included_quantity": {
            "type": [
              "integer",
              "null"
            ]
          },
          "label": {
            "type": "string"
          },
          "examples": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "quantity",
                "amount_excluding_tax",
                "amount_including_tax"
              ],
              "properties": {
                "quantity": {
                  "type": "integer"
                },
                "amount_excluding_tax": {
                  "type": "integer"
                },
                "amount_including_tax": {
                  "type": "integer"
                }
              }
            }
          }
        }
      },
      "PricingLimit": {
        "type": "object",
        "required": [
          "key",
          "label",
          "value",
          "unit",
          "period"
        ],
        "properties": {
          "key": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "value": {
            "type": [
              "integer",
              "null"
            ],
            "description": "null：上限なし"
          },
          "unit": {
            "type": "string"
          },
          "period": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "day",
                  "month",
                  "year"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "null：同時に持てる数。day・month：1日・1か月ごと"
          }
        }
      },
      "PricingTrial": {
        "type": "object",
        "required": [
          "days",
          "payment_method_required",
          "converts_to_paid",
          "once_per",
          "limits",
          "note"
        ],
        "properties": {
          "days": {
            "type": "integer"
          },
          "payment_method_required": {
            "type": "boolean"
          },
          "converts_to_paid": {
            "type": "boolean",
            "description": "終わると自動で有料の契約になるか"
          },
          "once_per": {
            "type": "string"
          },
          "limits": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PricingLimit"
            }
          },
          "note": {
            "type": "string"
          }
        }
      },
      "PricingCancellation": {
        "type": "object",
        "required": [
          "anytime",
          "minimum_term_months",
          "how",
          "service_ends",
          "refund"
        ],
        "properties": {
          "anytime": {
            "type": "boolean"
          },
          "minimum_term_months": {
            "type": "integer",
            "description": "0：最低契約期間なし"
          },
          "how": {
            "type": "string"
          },
          "service_ends": {
            "type": "string"
          },
          "refund": {
            "type": "string"
          }
        }
      }
    }
  }
}