Skip to main content

Cloudflare Scripts

Download

Download Cloudflare Scripts — zip containing the script and README.

Shell scripts for fetching zone configuration, DNS records, and routing rules from the Cloudflare API across all Pacing-managed domains.

Scripts

ScriptDescription
cloudflare-fetch-zones.shFetches zone details, DNS records, Page Rules, Transform Rules, Single Redirects, Workers Routes, SSL/TLS settings, and security level for all three domains

Usage

CLOUDFLARE_API_TOKEN=your_token ./cloudflare-fetch-zones.sh

Or export the token first:

export CLOUDFLARE_API_TOKEN=your_token
./cloudflare-fetch-zones.sh

Output is printed to stdout. Pipe to a file to save:

./cloudflare-fetch-zones.sh > output.txt

Output

The script prints a structured report for each domain in sequence. For each zone it includes:

  • Zone ID and plan — zone identifier, status, plan name, name servers
  • DNS records — all A, CNAME, MX, TXT records with proxy status and TTL
  • Page Rules — active page rules (if any)
  • Transform Rules (Redirects) — redirect rules via the Rulesets API
  • Single Redirects — bulk redirect rules
  • Workers Routes — Worker script assignments per route pattern
  • SSL/TLS settings — SSL mode per zone
  • Security Level — current security level setting

Domains covered (hardcoded): pacing.agency, pacingagency.com, pacingagency.co.uk.

Requirements

Environment variables:

VariableRequiredDescription
CLOUDFLARE_API_TOKENYesAPI token with Zone:Read permissions for all target zones

CLI tools:

  • curl — for API requests
  • jq — for JSON parsing and formatting

Getting an API token:

  1. Go to Cloudflare → Profile → API Tokens
  2. Create a token with Zone:Read permissions
  3. Scope to the specific zones or all zones as needed

Never commit the token to git. Store it in the root .env file:

CLOUDFLARE_API_TOKEN=