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

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

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

export const Image = ({img, alt, size}) => {
  return <Frame>
      <img src={img} alt={alt} />
    </Frame>;
};

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

**クエリ API エンドポイント** 機能を使用すると、ClickHouse Cloud console に保存された任意の SQL クエリから 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-fix-nav-issues/lbl07JY-gN--jKuL/images/cloud/guides/query-endpoints/console-api-keys.png?fit=max&auto=format&n=lbl07JY-gN--jKuL&q=85&s=3df0dd7d9b70aac8369a15ce4830eee5" size="md" alt="API Keys" width="866" height="804" data-path="images/cloud/guides/query-endpoints/console-api-keys.png" />

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

    <Image img="https://mintcdn.com/private-7c7dfe99-fix-nav-issues/lbl07JY-gN--jKuL/images/cloud/guides/query-endpoints/api-key-edit.png?fit=max&auto=format&n=lbl07JY-gN--jKuL&q=85&s=647e488809817d925f2702c6d2a78961" size="md" alt="Edit" width="2506" height="446" data-path="images/cloud/guides/query-endpoints/api-key-edit.png" />
  </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-fix-nav-issues/lbl07JY-gN--jKuL/images/cloud/guides/query-endpoints/specific-locations.png?fit=max&auto=format&n=lbl07JY-gN--jKuL&q=85&s=f985567c34b0ee19b595c1e18c77a8f0" size="md" alt="Specific locations" width="1336" height="1740" data-path="images/cloud/guides/query-endpoints/specific-locations.png" />

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

<Tip>
  **ガイド**

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