November 11, 2026 · 7 min read
Try it on your own accounts — 2,500 free credits a month, no credit card. By default every change waits for your approval.Start free
Playbooks

An AI agent for Cloudflare: DNS records, zone settings and Workers within your token's permissions

TL;DR

Marketing teams touch Cloudflare more than they expect: a verification record for a new ad platform, a redirect for a campaign landing page, a cache purge after a site change, a Worker that adds tracking parameters. An AI agent connected with your own Cloudflare API token reads zones, DNS records, settings, rules, traffic and Workers, and makes the changes you approve. This post covers the token permissions that matter, what the agent changes, what always waits for a person, and goals to start with.

Why Cloudflare suits an agent — with limits

Most Cloudflare requests from a marketing team are small and exact: add this TXT record, point this subdomain there, purge these pages. They are also the kind of change that can take a site or its email offline when it is wrong. An agent is useful when it reads first, shows the record before and after, and stays inside the access you gave it.

In Agent Planners, Cloudflare connects with an API token you create in your Cloudflare profile. The token's permissions are the limit: every call is made with it, and what it may not do is answered with the exact permission to add — never worked around.

The token permissions that matter

  • DNS Settings, DNS Views and DNS Firewall are not DNS. They are account permissions and do not reach a zone's records. A token holding all three was refused records on every zone in our test.
  • A token with zone permissions only (Cloudflare's "Edit zone DNS" template) lists no account. It still connects, through its zones, and its account areas — Workers, Pages, R2, KV, D1 — are reported as a missing permission rather than "0 Workers".
AreaPermission
DNS recordsThe ZONE permission named just "DNS" — Read, or Edit to change records
Zone settingsZone · Zone Settings · Read / Edit
Cache purgeZone · Cache Purge · Purge
TrafficZone · Analytics · Read
Workers codeAccount · Workers Scripts · Read / Edit
Workers routesZone · Workers Routes · Read / Edit

What the agent reads

  • Zones with their status, plan and name servers; DNS records and the BIND export.
  • Zone settings and rulesets: WAF, redirects, transforms and cache rules.
  • Traffic by day: requests, cached requests, bandwidth, threats, page views and unique visitors (unique visitors are per day and never added up).
  • Workers with their settings and source, Worker routes, Pages projects, R2 buckets, KV namespaces, D1 databases and registered domains.
18 reads in all, including get_capabilities, which re-checks what the token can and cannot do at any time.

What it changes

ChangeToolWho decides
Add or edit a DNS recordcreate_dns_record / update_dns_recordYour approval setting (read first, shown before and after)
Take a record off the proxyupdate_dns_recordAlways a person — it exposes the origin's address
Delete a DNS recorddelete_dns_recordAlways a person
Change a zone settingset_zone_settingYour approval setting; TLS and security settings, HSTS included, always a person
Purge the cachepurge_cacheYour approval setting for files, prefixes, hosts or tags; purging everything always a person
Add a Worker routecreate_worker_routeYour approval setting
Remove a Worker route / deploy Worker codedelete_worker_route / deploy_workerAlways a person
Anything else in the accountmutateYour approval setting; a DELETE, code, Pages deployments, registrar changes, DNS batches and pausing a zone or changing its plan always a person
"Your approval setting" means: by default the change waits for your approval card; auto-approve is opt-in per task, schedule or project. Refused outright: users, members, roles, API tokens, billing and subscriptions, adding a zone and deleting one — those stay in the Cloudflare dashboard.

Keeping the agent to some domains

A token can be limited to some zones in Cloudflare — the strongest limit. Agent Planners adds a second one: a Forbidden Rule that allows changes only on the domains you name, written in plain words ("MCP can only manage example.com on Cloudflare") and checked before every call, including raw API requests. How it works: Limit an AI agent to specific domains.

What we measured with live tokens

  • An account-level token reached one account and its 196 zones; zones, settings, rulesets, Workers, routes, D1 and registered domains answered, and every area it lacked was named with its permission.
  • A zone-only token connected through its zones (two accounts), read DNS records and changed them: two throwaway TXT records were created and deleted again on the allowed domain.
  • The domain lock refused a record, a zone setting, a Worker deploy and a raw request outside the allowed domain.

Goals to start with

GoalWhat the agent does
"Add the TXT record TikTok gave us for example.com."Reads the zone's records, then proposes the new record for your approval.
"Which DNS records on example.com point outside Cloudflare's proxy?"Lists records with proxied off and what each points to.
"Purge the cache for the three landing pages we just changed."Proposes a purge of those URLs only.
"How much traffic did the campaign subdomain get last week, and how much was cached?"Reads zone analytics by day.
"Which Workers run on our shop's routes?"Lists routes and the Worker each one serves.

Setting it up

  1. 1In Cloudflare open My Profile → API Tokens → Create Token and give it only what the agent should do — for DNS records the zone permission DNS, Edit to change them — on the zones it may touch.
  2. 2On Integrations press Connect with an API token on the Cloudflare card, paste the token and press Check and save. It is checked with Cloudflare before it is stored, encrypted.
  3. 3Pick the account for a task and write the goal — or call the same tools from Claude, Codex or Cursor over MCP.

Frequently asked questions

Can an AI agent manage Cloudflare DNS?
Yes, with your own API token holding the zone permission DNS (Edit to change records). It reads first and shows each record before and after; by default a change waits for your approval, and deleting a record always waits for a person.
Why does my token see no DNS records?
DNS Settings, DNS Views and DNS Firewall are account permissions. Records need the zone permission named just DNS; add it to the token in Cloudflare and press Refresh accounts.
Can the agent deploy a Cloudflare Worker?
It can prepare the deploy, but Worker code runs on your traffic, so deploying always waits for a person.
Does the agent get more access than my token?
No. Every call uses your token, and Cloudflare decides what it may do. Agent Planners adds approvals and refusals on top, never permissions.
Run your ad ops with an agent you can trust

Start free — 2,500 credits a month, no credit card. By default every write waits for your approval.

Keep reading