Skip to content
Scalekit Docs
Talk to an EngineerDashboard

Cloudflare connector

OAuth 2.0Developer ToolsMonitoringAutomation

Cloudflare is a cloud platform providing DNS management, CDN, security, and networking services. This connector enables automated management of zones, DNS...

Cloudflare connector

  1. Terminal window
    npm install @scalekit-sdk/node

    Full SDK reference: Node.js | Python

  2. Add your Scalekit credentials to your .env file. Find values in app.scalekit.com > Developers > API Credentials.

    .env
    SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
    SCALEKIT_CLIENT_ID=<your-client-id>
    SCALEKIT_CLIENT_SECRET=<your-client-secret>
  3. Register your Cloudflare credentials with Scalekit so it handles the token lifecycle. You do this once per environment.

    Dashboard setup steps

    Register your Scalekit environment with Cloudflare so Scalekit handles the OAuth flow and token lifecycle for your users. Create a Cloudflare OAuth client, then add its Client ID and Client Secret to your Scalekit connection.

    1. Copy the redirect URI from Scalekit

      • In the Scalekit dashboard, go to AgentKit > Connections > Create Connection. Find Cloudflare and click Create.

      • Click Use your own credentials and copy the redirect URI. It looks like https://<SCALEKIT_ENVIRONMENT_URL>/sso/v1/oauth/<CONNECTION_ID>/callback.

    2. Create an OAuth client in Cloudflare

      • Sign in to the Cloudflare dashboard and go to Manage account > OAuth clients.

      • Click Create OAuth client.

      • Fill in the Configure OAuth client form:

        • Client Name — for example, Agent Auth
        • Response TypeCode, Token
        • Grant typeAuthorization Code
        • Token Authentication MethodNone (PKCE)
        • Redirect (Callback) URLs — paste the redirect URI you copied from Scalekit, then press Return to add it
      • Click Next to continue to Select permission scopes.

        Cloudflare Create OAuth client form showing Client Name, Response Type, Grant type, Token Authentication Method, and Redirect URLs fields

    3. Select permission scopes

      Enable at least the scopes Scalekit requires:

      ScopeRequired
      Zone Read (zone.read)Yes
      DNS Read (dns.read)Yes
      DNS Write (dns.write)Only if your agent needs to manage DNS records
      Cache Purge (cache.purge)Only if your agent needs to purge cached content

      Click Create to finish creating the OAuth client.

    4. Copy your Client ID and Client Secret

      • Cloudflare shows the Client ID and Client Secret once the client is created.
      • Copy both values — the secret is shown only once.
    5. Add credentials in Scalekit

      • Return to the connection you created in Scalekit and enter:
        • Client ID — from your Cloudflare OAuth client
        • Client Secret — from your Cloudflare OAuth client
      • Click Save.
  4. quickstart.ts
    import { ScalekitClient } from '@scalekit-sdk/node'
    import 'dotenv/config'
    const scalekit = new ScalekitClient(
    process.env.SCALEKIT_ENV_URL,
    process.env.SCALEKIT_CLIENT_ID,
    process.env.SCALEKIT_CLIENT_SECRET,
    )
    const actions = scalekit.actions
    const connector = 'cloudflare'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize Cloudflare:', link)
    process.stdout.write('Press Enter after authorizing...')
    await new Promise(r => process.stdin.once('data', r))
    // Make your first call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'cloudflare_account_list',
    toolInput: {},
    })
    console.log(result)

Connect this agent connector to let your agent:

  • Update zone setting, ruleset entrypoint, dns record — Change the value of a single zone setting, such as ssl, always_use_https, min_tls_version, security_level, or cache_level
  • Get zone setting, zone, worker script — Retrieve the current value of a single zone setting, such as ssl, always_use_https, min_tls_version, security_level, or cache_level
  • Cache zone purge — Purge cached content for a Cloudflare zone
  • Create zone, worker route, page rule — Add a new domain (zone) to a Cloudflare account
  • Dashboard zone analytics — Retrieve aggregate traffic analytics for a Cloudflare zone: requests, bandwidth, threats, and cache statistics over a time window
  • Delete worker script, dns record, access application — Permanently delete a Cloudflare Worker script by name

Use the exact tool names from the Tool list below when you call execute_tool. If you’re not sure which name to use, list the tools available for the current user first.

cloudflare_access_application_create#Create a new Zero Trust Access application to protect a domain behind Cloudflare Access authentication policies.5 params

Create a new Zero Trust Access application to protect a domain behind Cloudflare Access authentication policies.

NameTypeRequiredDescription
account_idstringrequiredThe ID of the Cloudflare account
domainstringrequiredThe domain (and optional path) this application protects
namestringrequiredDisplay name of the application
session_durationstringoptionalHow long an authenticated session stays valid before re-authentication is required
typestringoptionalType of Access application
cloudflare_access_application_delete#Permanently delete a Zero Trust Access application and its policies. The protected domain becomes unprotected by Access. This cannot be undone.2 params

Permanently delete a Zero Trust Access application and its policies. The protected domain becomes unprotected by Access. This cannot be undone.

NameTypeRequiredDescription
account_idstringrequiredThe ID of the Cloudflare account
app_idstringrequiredThe ID of the Access application to delete
cloudflare_access_application_get#Retrieve details of a single Zero Trust Access application by ID. Use List Access Applications to find an application ID.2 params

Retrieve details of a single Zero Trust Access application by ID. Use List Access Applications to find an application ID.

NameTypeRequiredDescription
account_idstringrequiredThe ID of the Cloudflare account
app_idstringrequiredThe ID of the Access application to retrieve
cloudflare_access_application_list#List all Zero Trust Access applications configured in a Cloudflare account, with optional filtering by name or domain.5 params

List all Zero Trust Access applications configured in a Cloudflare account, with optional filtering by name or domain.

NameTypeRequiredDescription
account_idstringrequiredThe ID of the Cloudflare account
domainstringoptionalFilter applications by domain
namestringoptionalFilter applications by name
pageintegeroptionalPage number of results to return
per_pageintegeroptionalNumber of results per page
cloudflare_account_list#List all Cloudflare accounts the current authenticated user has access to, with optional filtering by account name.4 params

List all Cloudflare accounts the current authenticated user has access to, with optional filtering by account name.

NameTypeRequiredDescription
directionstringoptionalSort direction for results
namestringoptionalFilter accounts by name (partial match supported)
pageintegeroptionalPage number of results to return
per_pageintegeroptionalNumber of results per page
cloudflare_dns_record_create#Create a new DNS record in a Cloudflare zone.7 params

Create a new DNS record in a Cloudflare zone.

NameTypeRequiredDescription
contentstringrequiredDNS record content/value
namestringrequiredDNS record name (the subdomain or root domain)
typestringrequiredDNS record type
zone_idstringrequiredThe unique identifier for the zone to create the record in
priorityintegeroptionalPriority for MX or SRV records
proxiedbooleanoptionalWhether the record is proxied through Cloudflare (orange-clouded)
ttlintegeroptionalTime to live in seconds. 1 means automatic.
cloudflare_dns_record_delete#Permanently delete a DNS record from a Cloudflare zone. This cannot be undone.2 params

Permanently delete a DNS record from a Cloudflare zone. This cannot be undone.

NameTypeRequiredDescription
dns_record_idstringrequiredThe unique identifier of the DNS record to delete
zone_idstringrequiredThe unique identifier for the zone the record belongs to
cloudflare_dns_record_get#Retrieve details of a single DNS record by ID. Use List DNS Records to find a record ID.2 params

Retrieve details of a single DNS record by ID. Use List DNS Records to find a record ID.

NameTypeRequiredDescription
dns_record_idstringrequiredThe unique identifier of the DNS record to retrieve
zone_idstringrequiredThe unique identifier for the zone the record belongs to
cloudflare_dns_record_list#List, search, sort, and filter DNS records for a Cloudflare zone. Supports filtering by record type, name, and content.9 params

List, search, sort, and filter DNS records for a Cloudflare zone. Supports filtering by record type, name, and content.

NameTypeRequiredDescription
zone_idstringrequiredThe unique identifier for the zone to list DNS records from
contentstringoptionalFilter DNS records by content/value
directionstringoptionalSort direction (asc or desc)
matchstringoptionalWhether to match all or any filter conditions
namestringoptionalFilter DNS records by name
orderstringoptionalField to order results by
pageintegeroptionalPage number for pagination (default 1)
per_pageintegeroptionalNumber of results per page (default 20, max 100)
typestringoptionalFilter DNS records by type
cloudflare_dns_record_update#Replace an existing DNS record's type, name, and content. This is a full update — provide all fields you want the record to have, not just the ones changing.8 params

Replace an existing DNS record's type, name, and content. This is a full update — provide all fields you want the record to have, not just the ones changing.

NameTypeRequiredDescription
contentstringrequiredDNS record content/value
dns_record_idstringrequiredThe unique identifier of the DNS record to update
namestringrequiredDNS record name (the subdomain or root domain)
typestringrequiredDNS record type
zone_idstringrequiredThe unique identifier for the zone the record belongs to
priorityintegeroptionalPriority for MX or SRV records
proxiedbooleanoptionalWhether the record is proxied through Cloudflare (orange-clouded)
ttlintegeroptionalTime to live in seconds. 1 means automatic.
cloudflare_firewall_rule_create#Create a firewall rule on a Cloudflare zone that takes an action (block, challenge, allow, log, etc.) on requests matching a filter expression.5 params

Create a firewall rule on a Cloudflare zone that takes an action (block, challenge, allow, log, etc.) on requests matching a filter expression.

NameTypeRequiredDescription
actionstringrequiredAction to take when a request matches the expression
expressionstringrequiredCloudflare filter expression that requests must match to trigger this rule
zone_idstringrequiredThe unique identifier for the zone to create the rule in
descriptionstringoptionalDescription of the firewall rule
pausedbooleanoptionalWhether the rule is paused (inactive) on creation
cloudflare_firewall_rule_list#List the firewall rules configured on a Cloudflare zone, including their filter expressions and actions.3 params

List the firewall rules configured on a Cloudflare zone, including their filter expressions and actions.

NameTypeRequiredDescription
zone_idstringrequiredThe unique identifier for the zone to list firewall rules from
pageintegeroptionalPage number for pagination (default 1)
per_pageintegeroptionalNumber of results per page (default 20, max 100)
cloudflare_load_balancer_create#Create a new Load Balancer on a Cloudflare zone, distributing traffic for a hostname across one or more origin pools.10 params

Create a new Load Balancer on a Cloudflare zone, distributing traffic for a hostname across one or more origin pools.

NameTypeRequiredDescription
default_poolsarrayrequiredOrdered list of pool IDs ordinarily used to load balance traffic
fallback_poolstringrequiredPool ID used when all default_pools are unhealthy
namestringrequiredThe DNS hostname this load balancer will respond on
zone_idstringrequiredThe unique identifier for the zone to create the load balancer in
descriptionstringoptionalDescription of this load balancer
enabledbooleanoptionalWhether the load balancer is enabled
proxiedbooleanoptionalWhether the hostname should be proxied through Cloudflare
session_affinitystringoptionalSession affinity method used to bind a client to a origin
steering_policystringoptionalHow traffic is steered across default_pools
ttlintegeroptionalDNS TTL in seconds for this load balancer's hostname
cloudflare_load_balancer_list#List the Load Balancers configured on a Cloudflare zone.1 param

List the Load Balancers configured on a Cloudflare zone.

NameTypeRequiredDescription
zone_idstringrequiredThe unique identifier for the zone to list load balancers from
cloudflare_page_rule_create#Create a page rule on a Cloudflare zone that applies one or more settings to requests matching a URL pattern.5 params

Create a page rule on a Cloudflare zone that applies one or more settings to requests matching a URL pattern.

NameTypeRequiredDescription
actionsarrayrequiredJSON array of {id, value} action objects to apply, e.g. cache_level, forwarding_url, always_use_https
url_patternstringrequiredURL pattern that requests must match to trigger this rule
zone_idstringrequiredThe unique identifier for the zone to create the page rule in
priorityintegeroptionalPriority order when multiple page rules match the same request. Higher numbers take precedence.
statusstringoptionalWhether the page rule is active immediately
cloudflare_page_rule_list#List the page rules configured on a Cloudflare zone, including their URL targets, actions, and status.2 params

List the page rules configured on a Cloudflare zone, including their URL targets, actions, and status.

NameTypeRequiredDescription
zone_idstringrequiredThe unique identifier for the zone to list page rules from
statusstringoptionalFilter page rules by status
cloudflare_pages_project_list#List Cloudflare Pages projects in an account.1 param

List Cloudflare Pages projects in an account.

NameTypeRequiredDescription
account_idstringrequiredThe Cloudflare account identifier
cloudflare_ruleset_entrypoint_update#Deploy or update the active ruleset for a phase (e.g. http_request_firewall_custom for WAF custom rules) on a Cloudflare zone. This replaces the entire set of rules for that phase, so include every rule you want active, not just the ones you're changing.4 params

Deploy or update the active ruleset for a phase (e.g. http_request_firewall_custom for WAF custom rules) on a Cloudflare zone. This replaces the entire set of rules for that phase, so include every rule you want active, not just the ones you're changing.

NameTypeRequiredDescription
phase_namestringrequiredThe ruleset phase to deploy to
rulesarrayrequiredArray of rule objects to make up this phase's ruleset
zone_idstringrequiredThe unique identifier for the zone whose ruleset phase to update
descriptionstringoptionalDescription for this ruleset
cloudflare_user_get#Retrieve the profile details of the currently authenticated Cloudflare user, including name, email, and account memberships.0 params

Retrieve the profile details of the currently authenticated Cloudflare user, including name, email, and account memberships.

cloudflare_worker_route_create#Create a Worker route on a Cloudflare zone that dispatches matching requests to a Worker script. Use List Worker Scripts to find a script name first.3 params

Create a Worker route on a Cloudflare zone that dispatches matching requests to a Worker script. Use List Worker Scripts to find a script name first.

NameTypeRequiredDescription
patternstringrequiredURL pattern that triggers this route
zone_idstringrequiredThe unique identifier for the zone to create the route in
scriptstringoptionalName of the Worker script to dispatch matching requests to
cloudflare_worker_route_list#List the Worker routes configured on a Cloudflare zone, showing which URL patterns dispatch to which Worker script.1 param

List the Worker routes configured on a Cloudflare zone, showing which URL patterns dispatch to which Worker script.

NameTypeRequiredDescription
zone_idstringrequiredThe unique identifier for the zone to list routes from
cloudflare_worker_script_delete#Permanently delete a Cloudflare Worker script by name. Any routes or triggers bound to it stop working. This cannot be undone.2 params

Permanently delete a Cloudflare Worker script by name. Any routes or triggers bound to it stop working. This cannot be undone.

NameTypeRequiredDescription
account_idstringrequiredThe Cloudflare account identifier
script_namestringrequiredThe name of the Worker script to delete
cloudflare_worker_script_get#Download the raw JavaScript source of a Cloudflare Worker script by name. Use List Worker Scripts to find a script name.2 params

Download the raw JavaScript source of a Cloudflare Worker script by name. Use List Worker Scripts to find a script name.

NameTypeRequiredDescription
account_idstringrequiredThe Cloudflare account identifier
script_namestringrequiredThe name of the Worker script to retrieve
cloudflare_worker_script_list#Fetch a list of all uploaded Worker scripts in a Cloudflare account. Returns script names, creation dates, and modification timestamps.1 param

Fetch a list of all uploaded Worker scripts in a Cloudflare account. Returns script names, creation dates, and modification timestamps.

NameTypeRequiredDescription
account_idstringrequiredThe Cloudflare account identifier
cloudflare_zone_analytics_dashboard#Retrieve aggregate traffic analytics for a Cloudflare zone: requests, bandwidth, threats, and cache statistics over a time window.3 params

Retrieve aggregate traffic analytics for a Cloudflare zone: requests, bandwidth, threats, and cache statistics over a time window.

NameTypeRequiredDescription
zone_idstringrequiredThe unique identifier for the zone to fetch analytics for
sincestringoptionalStart of the analytics window (ISO 8601). Defaults to 6 hours ago.
untilstringoptionalEnd of the analytics window (ISO 8601). Defaults to now.
cloudflare_zone_create#Add a new domain (zone) to a Cloudflare account. After creation, update your domain's name servers to the ones Cloudflare returns to activate it.4 params

Add a new domain (zone) to a Cloudflare account. After creation, update your domain's name servers to the ones Cloudflare returns to activate it.

NameTypeRequiredDescription
account_idstringrequiredThe Cloudflare account to create the zone under
namestringrequiredThe domain name to add as a zone
jump_startbooleanoptionalAutomatically scan for existing DNS records when the zone is created
typestringoptionalWhether Cloudflare hosts the full zone or only a partial (CNAME setup) zone
cloudflare_zone_get#Retrieve details of a single Cloudflare zone by ID, including status, name servers, and plan information. Use List Zones to find a zone ID.1 param

Retrieve details of a single Cloudflare zone by ID, including status, name servers, and plan information. Use List Zones to find a zone ID.

NameTypeRequiredDescription
zone_idstringrequiredThe unique identifier for the zone to retrieve
cloudflare_zone_list#List, search, sort, and filter all zones in the Cloudflare account. Returns zone details including status, name servers, and plan information.7 params

List, search, sort, and filter all zones in the Cloudflare account. Returns zone details including status, name servers, and plan information.

NameTypeRequiredDescription
directionstringoptionalSort direction (asc or desc)
matchstringoptionalWhether to match all or any filter conditions
namestringoptionalFilter zones by domain name (exact match)
orderstringoptionalField to order results by
pageintegeroptionalPage number for pagination (default 1)
per_pageintegeroptionalNumber of results per page (default 20, max 50)
statusstringoptionalFilter zones by status
cloudflare_zone_purge_cache#Purge cached content for a Cloudflare zone. Purge everything, or scope the purge to specific file URLs, cache tags, or hostnames. Provide at most one of files, tags, or hosts when not purging everything.5 params

Purge cached content for a Cloudflare zone. Purge everything, or scope the purge to specific file URLs, cache tags, or hostnames. Provide at most one of files, tags, or hosts when not purging everything.

NameTypeRequiredDescription
zone_idstringrequiredThe unique identifier for the zone whose cache to purge
filesarrayoptionalJSON array of exact file URLs to purge from cache
hostsarrayoptionalJSON array of hostnames to purge all cached content for
purge_everythingbooleanoptionalPurge all cached content for the zone
tagsarrayoptionalJSON array of Cache-Tag values to purge
cloudflare_zone_setting_get#Retrieve the current value of a single zone setting, such as ssl, always_use_https, min_tls_version, security_level, or cache_level.2 params

Retrieve the current value of a single zone setting, such as ssl, always_use_https, min_tls_version, security_level, or cache_level.

NameTypeRequiredDescription
setting_namestringrequiredThe name of the setting to retrieve
zone_idstringrequiredThe unique identifier for the zone whose setting to retrieve
cloudflare_zone_setting_update#Change the value of a single zone setting, such as ssl, always_use_https, min_tls_version, security_level, or cache_level. Use Get Zone Setting first to see the current value and accepted options.3 params

Change the value of a single zone setting, such as ssl, always_use_https, min_tls_version, security_level, or cache_level. Use Get Zone Setting first to see the current value and accepted options.

NameTypeRequiredDescription
setting_namestringrequiredThe name of the setting to update
valuestringrequiredThe new value for the setting. Most Cloudflare settings take a string such as 'on', 'off', 'strict', or 'full'.
zone_idstringrequiredThe unique identifier for the zone whose setting to update