Cloudflare api key

Learn how to use Cloudflare api key with Composio

Overview

SLUG: CLOUDFLARE_API_KEY

Description

Cloudflare provides a suite of services to enhance the security, performance, and reliability of websites and applications.

Authentication Details

generic_api_key
stringRequired

Connecting to Cloudflare api key

Create an auth config

Use the dashboard to create an auth config for the Cloudflare api key toolkit. This allows you to connect multiple Cloudflare api key accounts to Composio for agents to use.

1

Select App

Navigate to [Cloudflare api key](https://platform.composio.dev?next_page=/marketplace/Cloudflare api key).

2

Configure Auth Config Settings

Select among the supported auth schemes of and configure them here.

3

Create and Get auth config ID

Click “Create Cloudflare api key Auth Config”. After creation, copy the displayed ID starting with ac_. This is your auth config ID. This is not a sensitive ID — you can save it in environment variables or a database. This ID will be used to create connections to the toolkit for a given user.

Connect Your Account

Using API Key

1from composio import Composio
2
3# Replace these with your actual values
4cloudflare_api_key_auth_config_id = "ac_YOUR_CLOUDFLARE_API_KEY_CONFIG_ID" # Auth config ID created above
5user_id = "0000-0000-0000" # UUID from database/app
6
7composio = Composio()
8
9def authenticate_toolkit(user_id: str, auth_config_id: str):
10 # Replace this with a method to retrieve an API key from the user.
11 # Or supply your own.
12 user_api_key = input("[!] Enter API key")
13
14 connection_request = composio.connected_accounts.initiate(
15 user_id=user_id,
16 auth_config_id=auth_config_id,
17 config={"auth_scheme": "API_KEY", "val": {"generic_api_key": user_api_key}}
18 )
19
20 # API Key authentication is immediate - no redirect needed
21 print(f"Successfully connected Cloudflare api key for user {user_id}")
22 print(f"Connection status: {connection_request.status}")
23
24 return connection_request.id
25
26
27connection_id = authenticate_toolkit(user_id, cloudflare_api_key_auth_config_id)
28
29# You can verify the connection using:
30connected_account = composio.connected_accounts.get(connection_id)
31print(f"Connected account: {connected_account}")

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the [Cloudflare api key toolkit’s playground](https://app.composio.dev/app/Cloudflare api key)

Python
1from composio import Composio
2from openai import OpenAI
3import json
4
5openai = OpenAI()
6composio = Composio()
7
8# User ID must be a valid UUID format
9user_id = "0000-0000-0000" # Replace with actual user UUID from your database
10
11tools = composio.tools.get(user_id=user_id, toolkits=["CLOUDFLARE_API_KEY"])
12
13print("[!] Tools:")
14print(json.dumps(tools))
15
16def invoke_llm(task = "What can you do?"):
17 completion = openai.chat.completions.create(
18 model="gpt-4o",
19 messages=[
20 {
21 "role": "user",
22 "content": task, # Your task here!
23 },
24 ],
25 tools=tools,
26 )
27
28 # Handle Result from tool call
29 result = composio.provider.handle_tool_calls(user_id=user_id, response=completion)
30 print(f"[!] Completion: {completion}")
31 print(f"[!] Tool call result: {result}")
32
33invoke_llm()

Tool List

Tool Name: Create DNS Record

Description

Tool to create a new DNS record in a Cloudflare zone. Use when you need to add a record (A, CNAME, TXT, MX, etc.) to a specified zone.

Action Parameters

comment
string
content
string
name
stringRequired
proxied
boolean
settings
object
tags
array
ttl
integerDefaults to 1
type
stringRequired
zone_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Zone Lockdown Rule

Description

Tool to create a Zone Lockdown rule. Use when you need to restrict access to specific URL patterns to defined IPs/CIDR ranges. Use after confirming zone_id.

Action Parameters

configurations
arrayRequired
description
string
paused
boolean
priority
integer
urls
arrayRequired
zone_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Rule in Ruleset

Description

Tool to add a rule to an existing ruleset. Use when you need to append or insert a new rule in a Cloudflare ruleset.

Action Parameters

account_id
string
accounts_or_zones
stringRequired
rule
objectRequired
ruleset_id
stringRequired
zone_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Ruleset

Description

Tool to create an account- or zone-scoped ruleset. Use after defining your ruleset details and selecting the correct scope.

Action Parameters

account_or_zone_id
stringRequired
accounts_or_zones
stringRequired
description
string
kind
stringRequired
name
stringRequired
phase
stringRequired
rules
array

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete DNS Record

Description

Tool to delete a DNS record. Use when you need to remove a specific DNS record from a zone after confirming both zone and record IDs.

Action Parameters

dns_record_id
stringRequired
zone_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete DNSSEC

Description

Tool to delete DNSSEC records for a zone. Use after disabling DNSSEC at the registrar to remove DNSSEC configuration.

Action Parameters

zone_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete Rule from Ruleset

Description

Tool to delete a specific rule from a ruleset. Use when you need to remove an outdated or incorrect rule from an account or zone ruleset after confirming IDs.

Action Parameters

account_or_zone_id
stringRequired
accounts_or_zones
stringRequired
rule_id
stringRequired
ruleset_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete Ruleset

Description

Tool to delete all versions of a ruleset. Use when you need to remove a ruleset from an account or zone after confirming no references exist.

Action Parameters

account_or_zone_id
stringRequired
accounts_or_zones
stringRequired
ruleset_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete a zone

Description

Tool to delete an existing zone. Use after confirming the zone_id to permanently remove the zone.

Action Parameters

zone_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Entrypoint Ruleset Version

Description

Tool to get a specific version of an entry point ruleset. Use after determining the ruleset phase and version.

Action Parameters

account_or_zone_id
stringRequired
accounts_or_zones
stringRequired
ruleset_phase
stringRequired
ruleset_version
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Lockdown Rule

Description

Tool to get a Zone Lockdown rule. Use when you need to fetch details of a specific lockdown rule by its ID within a Cloudflare zone.

Action Parameters

lockdown_id
stringRequired
zone_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Regional Tiered Cache

Description

Tool to get the regional tiered cache setting for a zone. Use when you need to verify if regional tiered cache is enabled for performance optimization after zone activation.

Action Parameters

zone_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Ruleset

Description

Tool to fetch the latest version of a ruleset by ID. Use after you have the ruleset scope and ID.

Action Parameters

account_id
string
accounts_or_zones
stringRequired
ruleset_id
stringRequired
zone_id
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Zone Details

Description

Tool to get details for a specific zone. Use when you need detailed zone metadata by ID.

Action Parameters

zone_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List DNS Records

Description

Tool to list DNS records for a given Cloudflare zone.

Action Parameters

content
string
direction
string
match
stringDefaults to all
name
string
order
string
page
integerDefaults to 1
per_page
integerDefaults to 20
type
string
zone_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Cloudflare Zones

Description

Tool to list, search, sort, and filter Cloudflare zones. Use when you need to retrieve a paginated list of zones available to the authenticated user.

Action Parameters

account.id
string
account.name
string
direction
string
match
stringDefaults to all
name
string
order
string
page
integerDefaults to 1
per_page
integerDefaults to 20
status
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Overwrite DNS Record

Description

Tool to completely overwrite a DNS record. Use when you need to replace all record details after confirming record type and name.

Action Parameters

comment
string
content
string
dns_record_id
stringRequired
name
stringRequired
proxied
boolean
settings
object
tags
array
ttl
integerDefaults to 1
type
stringRequired
zone_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Rerun Zone Activation Check

Description

Tool to trigger a new activation check for a PENDING zone. Use after initial zone creation to revalidate DNS activation. Limited rate: every 5 minutes on paygo/Enterprise or hourly on Free.

Action Parameters

zone_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update DNSSEC Status

Description

Tool to update DNSSEC configuration for a zone. Use when you need to enable or disable DNSSEC or adjust DNSSEC options after confirming the zone ID.

Action Parameters

dnssec_multi_signer
boolean
dnssec_presigned
boolean
dnssec_use_nsec3
boolean
status
string
zone_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update Lockdown Rule

Description

Tool to update a zone lockdown rule. Use when you need to modify the IP or URL settings of an existing Zone Lockdown rule after confirming the rule exists.

Action Parameters

configurations
arrayRequired
lock_downs_id
stringRequired
urls
arrayRequired
zone_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update Rule in Ruleset

Description

Tool to update a specific rule in a ruleset. Use when you need to modify a rule's configuration or reorder it after reviewing its current settings.

Action Parameters

account_or_zone_id
stringRequired
accounts_or_zones
stringRequired
position
object
rule
object
rule_id
stringRequired
ruleset_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update Ruleset

Description

Tool to update a Cloudflare ruleset, creating a new version. Use when you need to modify ruleset description or rules list.

Action Parameters

account_or_zone_id
stringRequired
accounts_or_zones
stringRequired
description
string
kind
string
name
string
phase
string
rules
array
ruleset_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update Cloudflare Zone

Description

Tool to edit a Cloudflare zone. Use when you need to update a single zone property at a time. Ensure only one of paused, type, or vanity_name_servers is provided per call.

Action Parameters

paused
boolean
type
string
vanity_name_servers
array
zone_id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Upload File to S3

Description

Tool to upload arbitrary file content to the app’s temporary R2/S3 bucket. Use when you need to stage files for actions requiring FileUploadable.

Action Parameters

content
stringRequired
file_name
stringRequired
mimetype
stringDefaults to text/plain

Action Response

data
objectRequired
error
string
successful
booleanRequired