Cloudflare

Cloud API token

Manage DNS records, zones, cache, KV, D1, Queues, R2 buckets and certificates, render pages with Browser Rendering, and inspect Workers and their logs from any Windmill script, flow or app.

Set up in 3 steps

1

Create an API token

In the Cloudflare dashboard, open My Profile then API Tokens. Create a token, granting only the permissions and zones your scripts need, and copy it.

2

Add the resource in Windmill

Open Resources, add a resource of type cloudflare, paste the token and your account ID (from the dashboard URL, dash.cloudflare.com/<account_id>). Account-level scripts (KV, R2, Workers, Browser Rendering, IP rules) need it. Leave email and key empty.

3

Run your first script

Run List Zones to check the token, then fork any of the scripts below. Zone and KV namespace inputs are dropdowns filled from your account.

Scripts

Building blocks, if none of the projects above fit. Fork one, run it, or call it as a step inside your own flow.

Submit a script →

Resource type

The shape of the credential every script on this page expects.

FieldTypeRequiredWhat it is
tokenstringYesAPI token from dash.cloudflare.com/profile/api-tokens. Grant only the permissions your scripts need (e.g. Zone: DNS Edit, Account: Workers KV Storage Edit).
account_idstringNoYour Cloudflare account ID, shown on the dashboard's Account home and in the URL (dash.cloudflare.com/<account_id>). Required by account-level scripts.
emailstringNoDeprecated (legacy Global API Key auth). Leave empty.
keystringNoDeprecated (legacy Global API Key). Leave empty.

Questions

What are the email and key fields?

The legacy Global API Key pair, kept for older scripts and marked deprecated. It authenticates as your whole account with no scoping — use an API token instead.

A call returns 403 on one zone but works on another

API tokens are scoped per zone and per permission. Edit the token in Cloudflare to include the zone, rather than widening it to everything.

How do I read and write R2 objects?

Through R2's S3-compatible API: create an R2 API token in the dashboard, then use the S3 integration with endpoint https://<account_id>.r2.cloudflarestorage.com. The Cloudflare scripts here list and create buckets.

Can Cloudflare events trigger a Windmill flow?

Yes, without polling. Add a webhook destination under Notifications (or Logpush) pointing at a Windmill webhook or HTTP route trigger, and pick the alerts to send.

Which token permissions do the scripts need?

Only what you run: Zone DNS Edit for DNS records, Zone Settings Edit for SSL/security/development mode, Cache Purge, Workers KV Storage Edit, Workers R2 Storage Edit, Browser Run (Browser Rendering) Write, Workers Observability Read, Workers Scripts Read, D1 Edit, Queues Edit, Account Firewall Access Rules Edit, and SSL and Certificates Edit for Origin CA certificates.

Is my token stored on the hub?

Never. It lives only in your own Windmill workspace, encrypted at rest.