Skip to main content

Cloudflare

Connect your Cloudflare account to enable CloudThinker agents to access documentation, analyze DNS traffic, and query analytics data.

Prerequisites

  • Cloudflare account with API access
  • Account ID (found in Cloudflare dashboard)
  • API Token with appropriate permissions for your selected services

Setup

1

Get Your Account ID

Log in to Cloudflare Dashboard → select any domain → copy your Account ID from the right sidebar under API section.
2

Create API Token

Go to My Profile → API Tokens → Create Token.Select permissions based on the services you want to enable (see Required Permissions below).
3

Connect in CloudThinker

Navigate to Connections → Cloudflare and enter:
  • API Token: The token you created
  • Account ID: Your Cloudflare account ID
  • Enabled Services: Select the services you want to use
Cloudflare connection dialog showing API token, Account ID, and service selection fields

Cloudflare connection dialog with API token, Account ID, and service selection


Connection Details

FieldDescriptionRequired
CLOUDFLARE_API_TOKENYour Cloudflare API tokenYes
CLOUDFLARE_ACCOUNT_IDYour Cloudflare account IDYes
ENABLED_SERVICESServices to enableYes

Supported Services

ServiceDescriptionUse Case
DocumentationAccess Cloudflare documentationReference docs during troubleshooting
DNS AnalyticsDNS query analytics and traffic dataAnalyze DNS patterns, identify issues
GraphQL AnalyticsAdvanced analytics via GraphQL APICustom analytics queries, detailed reports

Required Permissions

Documentation

No special permissions required. This service provides access to Cloudflare’s public documentation.

DNS Analytics

Create a custom token with these permissions:
PermissionAccess Level
ZoneRead
AnalyticsRead
DNSRead
Account SettingsRead

GraphQL Analytics

Create a custom token with these permissions:
PermissionAccess Level
Account AnalyticsRead
Zone AnalyticsRead
When creating your API token, you can combine permissions for multiple services into a single token.

Creating an API Token

1

Navigate to API Tokens

Go to Cloudflare DashboardMy Profile (top right) → API Tokens
2

Create Custom Token

Click Create TokenCreate Custom Token (at bottom)
3

Configure Permissions

Add the permissions needed for your selected services:For DNS Analytics:
  • Account → Account Settings → Read
  • Zone → Zone → Read
  • Zone → Analytics → Read
  • Zone → DNS → Read
For GraphQL Analytics:
  • Account → Account Analytics → Read
  • Zone → Zone Analytics → Read
4

Set Zone Resources

Under Zone Resources, select:
  • IncludeAll zones (or specific zones)
5

Create and Copy

Click Continue to summaryCreate TokenCopy the token immediately — it won’t be shown again.
Copy your API token immediately after creation. Cloudflare will not display it again, and you’ll need to create a new token if lost.

Troubleshooting

  • Verify your API token is correct and hasn’t been revoked
  • Check that the token has the required permissions for your selected services
  • Ensure the Account ID matches the account the token was created for
  • Verify the token has Analytics read permissions
  • Check that the zones have traffic generating data
  • Analytics data may take up to 24 hours to appear for new zones
  • Ensure all four permissions are granted: Zone, Analytics, DNS, Account Settings
  • Verify the token has access to the specific zones you’re querying
  • Check that DNS is proxied through Cloudflare (orange cloud enabled)
  • Verify Account Analytics and Zone Analytics permissions
  • Check the query syntax against Cloudflare’s GraphQL schema
  • Ensure you’re querying within the allowed time range

Security Best Practices

  • Minimal permissions — Only enable permissions for services you need
  • Token rotation — Rotate API tokens every 90 days
  • Zone restrictions — Limit token access to specific zones when possible
  • IP restrictions — Consider adding IP restrictions to your token
  • Audit regularly — Review active tokens in Cloudflare dashboard