> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-detect-table-modification.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> 保存クエリから REST API エンドポイントを簡単に作成

# クエリ API エンドポイント

export const Image = ({img, alt, size = "lg"}) => {
  const normalizedSize = ["sm", "md", "lg"].includes(size) ? size : "lg";
  return <div className={`ch-image-${normalizedSize}`}>
      <Frame>
        <img src={img} alt={alt} />
      </Frame>
    </div>;
};

対話型のデータ駆動アプリケーションを構築するには、高速なデータベース、適切に構造化されたデータ、最適化されたクエリだけでは十分ではありません。
フロントエンドやマイクロサービスでも、それらのクエリが返すデータを簡単に利用できる手段が必要です。できれば、適切に構造化された API を介して利用できるのが望ましいでしょう。

**クエリ API エンドポイント** 機能を使用すると、ClickHouse Cloud console に保存された任意の保存クエリから API エンドポイントを直接作成できます。
これにより、ネイティブドライバーを使って ClickHouse Cloud サービスに接続しなくても、HTTP 経由で API エンドポイントにアクセスして保存クエリを実行できます。

<div id="ip-access-control">
  ## IP アクセス制御
</div>

クエリ API エンドポイントでは、API キー単位の IP 許可リストが適用されます。SQL Console と同様に、クエリ API エンドポイントは ClickHouse のインフラストラクチャ内部からリクエストをプロキシするため、サービスレベルの IP 許可リスト設定は適用されません。

クエリ API エンドポイントを呼び出せるクライアントを制限するには、次の手順に従います。

<Steps>
  <Step>
    #### API キーの設定を開く

    1. ClickHouse Cloud Console → **Organization** → **API Keys** に移動します

    <Image img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/XOOlYBuM8pBBOTzZ/images/cloud/guides/query-endpoints/console-api-keys.webp?fit=max&auto=format&n=XOOlYBuM8pBBOTzZ&q=85&s=157360d33b7a78760e776076750ece07" size="md" alt="API Keys" width="866" height="804" data-path="images/cloud/guides/query-endpoints/console-api-keys.webp" />

    2. クエリ API エンドポイントで使用する API キーの横にある **Edit** をクリックします

    <Image img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/XOOlYBuM8pBBOTzZ/images/cloud/guides/query-endpoints/api-key-edit.webp?fit=max&auto=format&n=XOOlYBuM8pBBOTzZ&q=85&s=3485ea47d842ac974f10baf86bbe6932" size="md" alt="Edit" width="2506" height="446" data-path="images/cloud/guides/query-endpoints/api-key-edit.webp" />
  </Step>

  <Step>
    #### 許可する IP アドレスを追加する

    1. **Allow access to this API Key** セクションで、**Specific locations** を選択します
    2. IP アドレスまたは CIDR 範囲 (例: `203.0.113.1` または `203.0.113.0/24`) を入力します
    3. 必要に応じて複数のエントリを追加します

    <Image img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/XOOlYBuM8pBBOTzZ/images/cloud/guides/query-endpoints/specific-locations.webp?fit=max&auto=format&n=XOOlYBuM8pBBOTzZ&q=85&s=82278845480230691bc1a09f54b5be34" size="md" alt="Specific locations" width="1336" height="1740" data-path="images/cloud/guides/query-endpoints/specific-locations.webp" />

    クエリ API エンドポイントを作成するには、Admin Console ロールと、適切な権限を持つ API キーが必要です。
  </Step>
</Steps>

<Tip>
  **ガイド**

  クエリ API エンドポイントを数ステップで簡単に設定する方法については、[クエリ API エンドポイント ガイド](/ja/products/cloud/guides/sql-console/query-endpoints)を参照してください
</Tip>
