# Cloudflare API Setup - Quick Start **Last Updated:** 2026-01-31 **Document Version:** 1.0 **Status:** Active Documentation --- ## Automated Configuration via API This will configure both tunnel routes and DNS records automatically using the Cloudflare API. --- ## Step 1: Get Cloudflare API Credentials ### Option A: API Token (Recommended) 1. Go to: https://dash.cloudflare.com/profile/api-tokens 2. Click **Create Token** 3. Use **Edit zone DNS** template OR create custom token with: - **Zone** → **DNS** → **Edit** - **Account** → **Cloudflare Tunnel** → **Edit** 4. Copy the token ### Option B: Global API Key (Legacy) 1. Go to: https://dash.cloudflare.com/profile/api-tokens 2. Scroll to **API Keys** section 3. Click **View** next to "Global API Key" 4. Copy your Email and Global API Key --- ## Step 2: Set Up Credentials **Interactive Setup:** ```bash cd /home/intlc/projects/proxmox ./scripts/setup-cloudflare-env.sh ``` **Or manually create `.env` file:** ```bash cat > .env <.cfargotunnel.com` (🟠 Proxied) --- ## Troubleshooting ### "Could not determine account ID" Add to `.env`: ``` CLOUDFLARE_ACCOUNT_ID="your-account-id" ``` Get account ID from: Cloudflare Dashboard → Right sidebar → Account ID ### "API request failed" - Verify API token has correct permissions - Check token is not expired - Verify domain is in your Cloudflare account ### "Zone not found" - Verify domain `d-bis.org` is in your Cloudflare account - Or set `CLOUDFLARE_ZONE_ID` in `.env` --- ## Verify Configuration After running the script: 1. **Check Tunnel Routes:** - Zero Trust → Networks → Tunnels → Your Tunnel → Configure - Should see 4 public hostnames 2. **Check DNS Records:** - DNS → Records - Should see 4 CNAME records (🟠 Proxied) 3. **Test Endpoints:** ```bash curl https://rpc-http-pub.d-bis.org/health ``` --- ## Files Created - `.env` - Your API credentials (keep secure!) - Scripts are in: `scripts/configure-cloudflare-api.sh`