> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackone.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect Cloudflare with API Token – StackOne Hub

> Link a Cloudflare account in the StackOne Hub using API Token. End-user guide to authorize the integration and start using Cloudflare actions.

> [!WARNING]
>
> You need access to the Cloudflare dashboard with permissions to create API tokens. Account Owner or Super Administrator access is recommended for full API coverage.

## Finding Your Account ID

Your Account ID uniquely identifies your Cloudflare account and is required for account-scoped API calls.

**1. Sign in to Cloudflare**

Sign in to your [Cloudflare dashboard](https://dash.cloudflare.com/).

**2. Locate Account ID**

From the left sidebar, navigate to **Domains** and open any domain. On the **Overview** page, scroll to the **API** section in the right sidebar.

<ul>
  <li>Your **Account ID** is displayed under the **API** section in the right sidebar</li>
  <li>Copy this value and store it securely for use later</li>
  <li>Format: 32-character hexadecimal string (e.g., `023e105f4ecef8ad9ca31a8372d0c353`)</li>
</ul>

## Creating an API Token

Cloudflare API Tokens provide scoped access to specific resources and permissions. Create a custom token with the permissions needed for your use case.

**1. Navigate to API Tokens**

From the Cloudflare dashboard, click your **profile icon** in the top right corner.

<ul>
  <li>Click **Profile**</li>
  <li>Select the **API Tokens** tab</li>
</ul>

**2. Create a Custom Token**

Click the **Create Token** button. Under **Custom token**, click **Get started**.

**3. Configure Token Permissions**

Give your token a descriptive name (e.g., "StackOne Integration") and add the required permissions. The permissions you need depend on which Cloudflare resources you want to manage.

<ul>
  <li>**Account > Account Settings** (Read) — List and view accounts</li>
  <li>**Account > Account Members** (Read) — List and view account members</li>
  <li>**Account > Access: Organizations, Identity Providers, and Groups** (Read) — View Zero Trust Access groups</li>
  <li>**Account > Workers Scripts** (Edit) — Manage Workers scripts and cron triggers</li>
  <li>**Account > Workers Builds Configuration** (Read) — View Workers Builds (CI/CD) builds and build logs. Cloudflare only accepts user-owned tokens for Workers Builds</li>
  <li>**Account > Workers KV Storage** (Edit) — Manage KV namespaces and key-value pairs</li>
  <li>**Account > Workers R2 Storage** (Edit) — Manage R2 buckets</li>
  <li>**Account > D1** (Edit) — Manage D1 databases and run queries</li>
  <li>**Account > Cloudflare Pages** (Edit) — Manage Pages projects and deployments</li>
  <li>**Account > AI Gateway** (Edit) — Manage AI Gateway instances and view logs</li>
  <li>**Account > Account Firewall Access Rules** (Edit) — Manage IP access rules</li>
  <li>**Account > Account Rulesets** (Read) — View account-level rulesets</li>
  <li>**Account > Load Balancing: Monitors and Pools** (Read) — View LB pools and monitors</li>
  <li>**Account > Cloudflare Tunnel** (Edit) — Manage Cloudflare Tunnels</li>
  <li>**Zone > Zone** (Edit) — Manage zones</li>
  <li>**Zone > Zone Settings** (Edit) — Manage zone configuration</li>
  <li>**Zone > DNS** (Edit) — Manage DNS records and view analytics</li>
  <li>**Zone > SSL and Certificates** (Edit) — Manage SSL certificates</li>
  <li>**Zone > Firewall Services** (Read) — View firewall rules and WAF rulesets</li>
  <li>**Zone > Cache Purge** (Purge) — Purge cached content</li>
  <li>**Zone > Load Balancers** (Edit) — Manage load balancers</li>
  <li>**Zone > Waiting Room** (Edit) — Manage waiting rooms</li>
  <li>**Zone > Workers Routes** (Edit) — Manage Workers routes</li>
  <li>**Zone > Analytics** (Read) — View zone analytics</li>
  <li>**Zone > Page Rules** (Edit) — Manage page rules</li>
  <li>**Zone > Health Checks** (Edit) — Manage standalone healthchecks</li>
  <li>**User > API Tokens** (Read) — Required for token verification</li>
  <li>**User > Memberships** (Read) — View account memberships</li>
</ul>

**4. Set Zone and Account Resources**

Under **Account Resources**, select your account. Under **Zone Resources**, choose the zones you want the token to access.

<ul>
  <li>Select **All accounts** or a specific account</li>
  <li>Select **All zones** or specific zones</li>
  <li>Optionally restrict by IP address under **Client IP Address Filtering**</li>
</ul>

**5. Select Token Type**

When creating your token, you will be asked to select a **Token Type**.

<ul>
  <li>Select **User-owned token** for tokens created under **Profile > API Tokens**</li>
  <li>Select **Account-owned token** for tokens created under **Account > API Tokens**</li>
  <li>When connecting via StackOne, select the matching **Token Type** to ensure successful verification</li>
</ul>

**6. Create and Copy the Token**

Click **Continue to summary**, review the permissions, and click **Create Token**.

<ul>
  <li>Copy the token value immediately — it is shown only once and cannot be retrieved later</li>
  <li>Store it securely for use later</li>
  <li>You can test the token with the **Test this token** button on the confirmation page</li>
</ul>

## Link the Account

**1. Connect**

<ul>
  <li>Click **Connect**.</li>
  <li>If applicable, the provider will redirect you to a sign-in or authorization page. Complete the provider's authorization flow.</li>
  <li>Once authorization is successful, you will see a confirmation popup.</li>
</ul>

**2. Use Actions**

Connect an AI platform to the linked account's actions. See [AI Platforms](https://docs.stackone.com/ai-platforms/overview.md).

Other ways to call actions are listed in [Protocols & SDKs](https://docs.stackone.com/connect/protocols-and-sdks.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.