Setu Recipes: reusable digital workers across every app.Browse templates

Integrations / Cloudflare

Cloudflare

Cloudflare: list zones and DNS records, create and update DNS records, and purge the cache.

6 actions API key 3 read2 write1 destructive Calls api.cloudflare.com

Connect

TypeScript
const conn = await setu.connections.initiate({ userId: "user_1", toolkit: "cloudflare" });
console.log(conn.connectUrl); // show this to your user
await conn.waitUntilActive();

Permissions requested

This toolkit uses a single credential and requests no scopes.

Actions

Create DNS recordwritecloudflare.create_dns_recordCreate a DNS record in a zone. Changes live DNS for that name.
InputTypeDescription
zone_idstringRequiredZone ID
namestringRequiredFull record name, e.g. www.example.com
typestringRequiredRecord type
contentstringRequiredRecord value, e.g. an IPv4 address or hostname
ttlintegerOptionalSeconds (60-86400) or 1 for automatic
proxiedbooleanOptionalRoute through Cloudflare
commentstringOptionalNote about the record
TypeScript
await setu.execute({
  userId: "user_1",
  action: "cloudflare.create_dns_record",
  input: {
    "zone_id": "<zone_id>",
    "name": "<name>",
    "type": "<type>",
    "content": "<content>"
  },
});
List DNS recordsreadcloudflare.list_dns_recordsList DNS records of a zone, optionally filtered by type or a search term matching name or content.
InputTypeDescription
zone_idstringRequiredZone ID
typestringOptionalRecord type, e.g. A or CNAME
searchstringOptionalMatch on name, content or comment
per_pageintegerOptionalRecords per page
pageintegerOptionalPage number
TypeScript
await setu.execute({
  userId: "user_1",
  action: "cloudflare.list_dns_records",
  input: {
    "zone_id": "<zone_id>"
  },
});
List zonesreadcloudflare.list_zonesList the Cloudflare zones (domains) the token can see, optionally filtered by name or status.
InputTypeDescription
namestringOptionalDomain name to match
statusstringOptionalZone status
per_pageintegerOptionalZones per page, 5 to 50
TypeScript
await setu.execute({
  userId: "user_1",
  action: "cloudflare.list_zones",
  input: {},
});
Purge cachedestructivecloudflare.purge_cachePurge cached content for a zone: specific URLs, hostnames, tags or prefixes, or everything (purge_everything must then be the only option).
InputTypeDescription
zone_idstringRequiredZone ID
purge_everythingbooleanOptionalPurge all cached content; use alone
filesarray of stringOptionalFull URLs to purge
hostsarray of stringOptionalHostnames to purge
tagsarray of stringOptionalCache-Tag values to purge
prefixesarray of stringOptionalURL prefixes without scheme
TypeScript
await setu.execute({
  userId: "user_1",
  action: "cloudflare.purge_cache",
  input: {
    "zone_id": "<zone_id>"
  },
  confirm: true,
});
Update DNS recordwritecloudflare.update_dns_recordChange fields of an existing DNS record (content, TTL, proxied...). Only the fields you pass change; this affects live DNS.
InputTypeDescription
zone_idstringRequiredZone ID
dns_record_idstringRequiredDNS record ID
namestringOptionalFull record name, e.g. www.example.com
typestringOptionalRecord type
contentstringOptionalRecord value, e.g. an IPv4 address or hostname
ttlintegerOptionalSeconds (60-86400) or 1 for automatic
proxiedbooleanOptionalRoute through Cloudflare
commentstringOptionalNote about the record
TypeScript
await setu.execute({
  userId: "user_1",
  action: "cloudflare.update_dns_record",
  input: {
    "zone_id": "<zone_id>",
    "dns_record_id": "<dns_record_id>"
  },
});
Verify tokenreadcloudflare.verify_tokenCheck that the API token is valid and active, with its expiry.

No input.

TypeScript
await setu.execute({
  userId: "user_1",
  action: "cloudflare.verify_token",
  input: {},
});