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
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.
| Input | Type | Description | |
|---|---|---|---|
zone_id | string | Required | Zone ID |
name | string | Required | Full record name, e.g. www.example.com |
type | string | Required | Record type |
content | string | Required | Record value, e.g. an IPv4 address or hostname |
ttl | integer | Optional | Seconds (60-86400) or 1 for automatic |
proxied | boolean | Optional | Route through Cloudflare |
comment | string | Optional | Note about the record |
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.
| Input | Type | Description | |
|---|---|---|---|
zone_id | string | Required | Zone ID |
type | string | Optional | Record type, e.g. A or CNAME |
search | string | Optional | Match on name, content or comment |
per_page | integer | Optional | Records per page |
page | integer | Optional | Page number |
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.
| Input | Type | Description | |
|---|---|---|---|
name | string | Optional | Domain name to match |
status | string | Optional | Zone status |
per_page | integer | Optional | Zones per page, 5 to 50 |
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).
| Input | Type | Description | |
|---|---|---|---|
zone_id | string | Required | Zone ID |
purge_everything | boolean | Optional | Purge all cached content; use alone |
files | array of string | Optional | Full URLs to purge |
hosts | array of string | Optional | Hostnames to purge |
tags | array of string | Optional | Cache-Tag values to purge |
prefixes | array of string | Optional | URL prefixes without scheme |
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.
| Input | Type | Description | |
|---|---|---|---|
zone_id | string | Required | Zone ID |
dns_record_id | string | Required | DNS record ID |
name | string | Optional | Full record name, e.g. www.example.com |
type | string | Optional | Record type |
content | string | Optional | Record value, e.g. an IPv4 address or hostname |
ttl | integer | Optional | Seconds (60-86400) or 1 for automatic |
proxied | boolean | Optional | Route through Cloudflare |
comment | string | Optional | Note about the record |
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.
await setu.execute({
userId: "user_1",
action: "cloudflare.verify_token",
input: {},
});