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

<section data-guide-section data-guide-scopes="">
  <h2>Finding Your Account ID</h2>

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

  <Steps>
    <Step title="Sign in to Cloudflare">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Sign in to your <a href="https://dash.cloudflare.com/" target="_blank" rel="noopener noreferrer">Cloudflare dashboard</a>.</p>
      </div>
    </Step>

    <Step title="Locate Account ID">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>From the left sidebar, navigate to <strong>Domains</strong> and open any domain. On the <strong>Overview</strong> page, scroll to the <strong>API</strong> section in the right sidebar.</p>

        <ul>
          <li>Your <strong>Account ID</strong> is displayed under the <strong>API</strong> 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>
      </div>
    </Step>
  </Steps>
</section>

<section data-guide-section data-guide-scopes="">
  <h2>Creating an API Token</h2>

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

  <Steps>
    <Step title="Navigate to API Tokens">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>From the Cloudflare dashboard, click your <strong>profile icon</strong> in the top right corner.</p>

        <ul>
          <li>Click <strong>Profile</strong></li>
          <li>Select the <strong>API Tokens</strong> tab</li>
        </ul>
      </div>
    </Step>

    <Step title="Create a Custom Token">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Click the <strong>Create Token</strong> button. Under <strong>Custom token</strong>, click <strong>Get started</strong>.</p>
      </div>
    </Step>

    <Step title="Configure Token Permissions">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>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.</p>

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

    <Step title="Set Zone and Account Resources">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Under <strong>Account Resources</strong>, select your account. Under <strong>Zone Resources</strong>, choose the zones you want the token to access.</p>

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

    <Step title="Select Token Type">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>When creating your token, you will be asked to select a <strong>Token Type</strong>.</p>

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

    <Step title="Create and Copy the Token">
      <div data-guide-step data-guide-scopes="" data-guide-display-scopes-list="">
        <p>Click <strong>Continue to summary</strong>, review the permissions, and click <strong>Create Token</strong>.</p>

        <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 <strong>Test this token</strong> button on the confirmation page</li>
        </ul>
      </div>
    </Step>
  </Steps>
</section>

<div data-whitelabel-hide>
  <h2>Linking the Account from the Hub</h2>

  <Steps>
    <Step title="Navigate to the Hub">
      Use one of the three <a href="/guides/accounts-section#linking-accounts">Linking Account Methods</a> to access the Hub.
    </Step>

    <Step title="Fill out the fields">
      Fill out the following fields using details from your provider:

      <ul>
        <li><strong>API Token</strong></li>
        <li><strong>Account ID</strong></li>
        <li><strong>Token Type</strong> (Optional)</li>
      </ul>
    </Step>

    <Step title="Connect">
      <ul>
        <li>Click <strong>Connect</strong></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>
    </Step>
  </Steps>

  <p>If the account linking is successful, you will see the newly linked account in your <a href="/guides/accounts-section">Accounts</a> page.</p>
</div>
