> ## 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.

> Easily spin up REST API endpoints from your saved queries

# Query API endpoints

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

Building interactive data-driven applications requires not only a fast database, well-structured data, and optimized queries.
Your front-end and microservices also need an easy way to consume the data returned by those queries, preferably via well-structured APIs.

The **Query API Endpoints** feature allows you to create an API endpoint directly from any saved SQL query in the ClickHouse Cloud console.
You'll be able to access API endpoints via HTTP to execute your saved queries without needing to connect to your ClickHouse Cloud service via a native driver.

<h2 id="ip-access-control">
  IP Access Control
</h2>

Query API endpoints respect API key-level IP whitelisting. Similar to the SQL Console, Query API endpoints proxy requests from within ClickHouse's infrastructure, so service-level IP whitelist settings don't apply.

To restrict which clients can call your Query API endpoints:

<Steps>
  <Step>
    <h4 id="open-settings">
      Open API key settings
    </h4>

    1. Go to 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. Click **Edit** next to the API key used for Query API endpoints

    <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>
    <h4 id="add-ips">
      Add allowed IP addresses
    </h4>

    1. In the **Allow access to this API Key** section, select **Specific locations**
    2. Enter IP addresses or CIDR ranges (e.g., `203.0.113.1` or `203.0.113.0/24`)
    3. Add multiple entries as needed

    <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" />

    Creating Query API endpoints requires an Admin Console Role and an API key with appropriate permissions.
  </Step>
</Steps>

<Tip>
  **Guide**

  See the [Query API endpoints guide](/products/cloud/guides/sql-console/query-endpoints) for instructions on how to set up
  query API endpoints in a few easy steps
</Tip>
