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

# Managing API keys

> ClickHouse Cloud provides an API utilizing OpenAPI that allows you to programmatically manage your account and aspects of your services.

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

ClickHouse Cloud provides an API utilizing OpenAPI that allows you to programmatically manage your account and aspects of your services.

<Note>
  This document covers the ClickHouse Cloud API. For database API endpoints, please see [Cloud Endpoints API](/products/cloud/guides/sql-console/query-endpoints)
</Note>

1. You can use the **API Keys** tab on the left menu to create and manage your API keys.

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-8a08bda2/Crkay9vSr-K_Gf1T/images/cloud/manage/openapi1.png?fit=max&auto=format&n=Crkay9vSr-K_Gf1T&q=85&s=c7518521643d56afdf61ae4a091f74a4" size="sm" alt="API Keys tab" border width="433" height="472" data-path="images/cloud/manage/openapi1.png" />

2. The **API Keys** page will initially display a prompt to create your first API key as shown below. After your first key is created, you can create new keys using the `New API Key` button that appears in the top right corner.

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-8a08bda2/Crkay9vSr-K_Gf1T/images/cloud/manage/openapi2.png?fit=max&auto=format&n=Crkay9vSr-K_Gf1T&q=85&s=401a2d57570310bf3eb9bdfcbf2c6c35" size="md" alt="API Keys page" border width="1036" height="466" data-path="images/cloud/manage/openapi2.png" />

3. To create an API key, specify the key name, permissions for the key, and expiration time, then click `Generate API Key`.

<br />

<Note>
  Permissions align with ClickHouse Cloud [predefined roles](/products/cloud/reference/security/console-roles). The developer role has read-only permissions for assigned services and the admin role has full read and write permissions.
</Note>

<Tip>
  **Query API Endpoints**

  To use API keys with [Query API Endpoints](/products/cloud/guides/sql-console/query-endpoints), set Organization Role to `Member` (minimum) and grant Service Role access to `Query Endpoints`.
</Tip>

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-8a08bda2/Crkay9vSr-K_Gf1T/images/cloud/manage/openapi3.png?fit=max&auto=format&n=Crkay9vSr-K_Gf1T&q=85&s=db938f52e03d608071c26d453fccdbd3" size="md" alt="Create API key form" border width="661" height="410" data-path="images/cloud/manage/openapi3.png" />

4. The next screen will display your Key ID and Key secret. Copy these values and put them somewhere safe, such as a vault. The values won't be displayed after you leave this screen.

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-8a08bda2/Crkay9vSr-K_Gf1T/images/cloud/manage/openapi4.png?fit=max&auto=format&n=Crkay9vSr-K_Gf1T&q=85&s=a14fc96628283b08fc58e0abafd07ff8" size="md" alt="API key details" border width="653" height="271" data-path="images/cloud/manage/openapi4.png" />

5. The ClickHouse Cloud API uses [HTTP Basic Authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication) to verify the validity of your API keys. Here is an example of how to use your API keys to send requests to the ClickHouse Cloud API using `curl`:

```bash theme={null}
$ KEY_ID=mykeyid
$ KEY_SECRET=mykeysecret

$ curl --user $KEY_ID:$KEY_SECRET https://api.clickhouse.cloud/v1/organizations
```

6. Returning to the **API Keys** page, you will see the key name, last four characters of the Key ID, permissions, status, expiration date, and creator. You're able to edit the key name, permissions, and expiration from this screen. Keys may also be disabled or deleted form this screen.

<br />

<Note>
  Deleting an API key is a permanent action. Any services using the key will immediately lose access to ClickHouse Cloud.
</Note>

<Image img="https://mintcdn.com/private-7c7dfe99-mintlify-8a08bda2/Crkay9vSr-K_Gf1T/images/cloud/manage/openapi5.png?fit=max&auto=format&n=Crkay9vSr-K_Gf1T&q=85&s=818e9b5bf350525aece28272db7fc9b3" size="md" alt="API Keys management page" border width="1092" height="335" data-path="images/cloud/manage/openapi5.png" />

<h2 id="endpoints">
  Endpoints
</h2>

Refer details on endpoints, refer to the [API reference](/api-reference/organization/get-list-of-available-organizations).
Use your API Key and API Secret with the base URL `https://api.clickhouse.cloud/v1`.
