Hit the Cloudflare REST API directly when wrangler CLI or MCP servers aren't the right tool. For bulk operations, fleet-wide changes, and features that wrangler doesn't expose.
Confirm successful installation by checking the skill directory location:
.cursor/skills/cloudflare-api
Restart Cursor to activate cloudflare-api. Access via /cloudflare-api in your agent's command palette.
โ
Security Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
Hit the Cloudflare REST API directly when wrangler CLI or MCP servers aren't the right tool. For bulk operations, fleet-wide changes, and features that wrangler doesn't expose.
When to Use This Instead of Wrangler or MCP
Use case
Wrangler
MCP
This skill
Deploy a Worker
Yes
Yes
No
Create a D1 database
Yes
Yes
No
Bulk update 50 DNS records
Slow (one at a time)
Slow (one tool call each)
Yes โ batch script
Custom hostnames for white-label
No
Partial
Yes
Email routing rules
No
Partial
Yes
WAF/firewall rules
No
Yes but verbose
Yes โ direct API
Redirect rules in bulk
No
One at a time
Yes โ batch script
Zone settings across 20 zones
No
20 separate calls
Yes โ fleet script
Cache purge by tag/prefix
No
Yes
Yes (when scripting)
Worker route management
Limited
Yes
Yes (when bulk)
Analytics/logs query
No
Partial
Yes โ GraphQL
D1 query/export across databases
One DB at a time
One DB at a time
Yes โ cross-DB scripts
R2 bulk object operations
No
One at a time
Yes โ S3 API + batch
KV bulk read/write/delete
One at a time
One at a time
Yes โ bulk endpoints
Vectorize query/delete
No
Via Worker only
Yes โ direct API
Queue message injection
No
Via Worker only
Yes โ direct API
Audit all resources in account
No
Tedious
Yes โ inventory script
Rule of thumb: Single operations โ MCP or wrangler. Bulk/fleet/scripted โ API directly.
Auth Setup
API Token (recommended)
Create a scoped token at: Dashboard โ My Profile โ API Tokens โ Create Token
# Store itexportCLOUDFLARE_API_TOKEN="your-token-here"# Test itcurl-s"https://api.cloudflare.com/client/v4/user/tokens/verify"\-H"Authorization: Bearer $CLOUDFLARE_API_TOKEN"| jq '.success'
Token scopes: Always use minimal permissions. Common presets:
"Edit zone DNS" โ for DNS operations
"Edit zone settings" โ for zone config changes
"Edit Cloudflare Workers" โ for Worker route management
"Read analytics" โ for GraphQL analytics
Account and Zone IDs
# List your zones (find zone IDs)curl-s"https://api.cloudflare.com/client/v4/zones?per_page=50"\-H"Authorization: Bearer $CLOUDFLARE_API_TOKEN"| jq '.result[] | {name, id}'# Get zone ID by domain nameZONE_ID=$(curl-s"https://api.cloudflare.com/client/v4/zones?name=example.com"\-H"Authorization: Bearer $CLOUDFLARE_API_TOKEN"| jq -r'.result[0].id')
Store IDs in environment or a config file โ don't hardcode them in scripts.
Workflows
Bulk DNS Operations
Add/update many records at once (e.g. migrating a domain, setting up a new client):
# Pattern: read records from a file, create in batchwhileIFS=','read-rtype name content proxied;docurl-s-X POST "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records"\-H"Authorization: Bearer $CLOUDFLARE_API_TOKEN"\-H"Content-Type: application/json"\-d"{\"type\":\"$type\",\"name\":\"$name\",\"content\":\"$content\",\"proxied\":$proxied,\"ttl\":1}"\| jq '{name: .result.name, id: .result.id, success: .success}'sleep0.25# Rate limit: 1200 req/5mindone< dns-records.csv
Export all records from a zone (backup or migration):
Client setup: They add a CNAME: app.clientdomain.com โ your-worker.your-domain.com
Email Routing Rules
# Enable email routing on zonecurl-s-X PUT "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/email/routing/enable"\-H"Authorization: Bearer $CLOUDFLARE_API_TOKEN"# Create a routing rule (forward info@ to a real address)curl-s-X POST "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/email/routing/rules"\-H"Authorization: Bearer $CLOUDFLARE_API_TOKEN"\-H"Content-Type: application/json"\-d'{
"name": "Forward info@",
"enabled": true,
"matchers": [{"type": "literal", "field": "to", "value": "[email protected]"}],
"actions": [{"type": "forward", "value": ["[email protected]"]}]
}'| jq '.success'# Create catch-all rulecurl-s-X POST "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/email/routing/rules"\-H"Authorization: Bearer $CLOUDFLARE_API_TOKEN"\-H"Content-Type: application/json"\-d'{
"name": "Catch-all",
"enabled": true,
"matchers": [{"type": "all"}],
"actions": [{"type": "forward", "value": ["[email protected]"]}]
}'| jq '.success'# List rulescurl-s"https://api.cloudflare.com/client/v4/zones/$ZONE_ID/email/routing/rules"\-H"Authorization: Bearer $CLOUDFLARE_API_TOKEN"| jq '.result[] | {name, enabled, matchers, actions}'
Cache Purge
# Purge everything (nuclear option)curl-s-X POST "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/purge_cache"\-H"Authorization: Bearer $CLOUDFLARE_API_TOKEN"\-H"Content-Type: application/json"\-d'{"purge_everything": true}'# Purge specific URLscurl-s-X POST "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/purge_cache"\-H"Authorization: Bearer $CLOUDFLARE_API_TOKEN"\-H"Content-Type: application/json"\
Implementation Guide
Prerequisites
โบClaude Desktop or compatible AI client with skill support
โบClear understanding of task or problem to solve
โบWillingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Steps
1Install skill using provided installation command
2Test with simple use case relevant to your work
3Evaluate output quality and relevance
4Iterate on prompts to improve results
5Integrate into regular workflow if valuable
Common Pitfalls
โ Expecting perfect results without iteration
โ Not providing enough context in prompts
โ Using skill for tasks outside its intended scope
โ Accepting outputs without review and validation
Best Practices
โ Do
+Start with clear, specific prompts
+Provide relevant context and constraints
+Review and refine all outputs before using
+Iterate to improve output quality
+Document successful prompt patterns
โ Don't
โDon't use without understanding skill limitations
โDon't skip validation of outputs
โDon't share sensitive information in prompts
โDon't expect skill to replace human judgment
๐ก Pro Tips
โ Be specific about desired format and style
โ Ask for multiple options to choose from
โ Request explanations to understand reasoning
โ Combine AI efficiency with human expertise
When to Use This
โ Use when
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
โ Avoid when
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
Learning Path
1Familiarize yourself with skill capabilities and limitations
2Start with low-risk, non-critical tasks
3Progress to more complex and valuable use cases
4Build expertise through regular use and experimentation