Skip to content

Using Cloudflare

Practical guide for working with Cloudflare DNS, Workers, KV, and zones through Fp Switchboard.

  • Zone ID, Account ID, DNS Record ID: all 32-char hex but NOT interchangeable
  • Workers use SCRIPT NAME in URL (not an ID)
  • KV: eventual consistency (60s delay), max 1 write/second to same key
  • Authentication: Bearer token ONLY or X-Auth-Email + X-Auth-Key (never mix)
  • DNS updates: lookup zone_id, then lookup record_id, then PUT with ALL fields

IDs are Not Interchangeable Critical

Section titled “IDs are Not Interchangeable ”

Zone ID, Account ID, DNS Record ID are all 32-char hex but cannot be used interchangeably.

Example
WrongUsing Account ID where Zone ID is required
CorrectGet Zone ID from /zones?name=example.com

Error: Invalid zone identifier

Workers Use Script Names Critical

Section titled “Workers Use Script Names ”

Workers API uses human-readable script names, not IDs.

Example
Wrong/workers/scripts/abc123
Correct/accounts/{account_id}/workers/scripts/my-worker-script

Cannot Mix Auth Methods Critical

Section titled “Cannot Mix Auth Methods ”

Use ONLY Bearer token OR ONLY X-Auth-Email + X-Auth-Key. Never both.

Error codes: 6003, 6103, 6111

KV Eventual Consistency Important

Section titled “KV Eventual Consistency ”

KV changes may take 60+ seconds to propagate. Max 1 write/second to same key. Design for eventual consistency.

DNS Updates Need Full Payload Important

Section titled “DNS Updates Need Full Payload ”

PUT /dns_records requires ALL fields (type, name, content, ttl, proxied), not just the changed ones.

  1. GET /zones?name=example.com to get zone_id
  2. GET /zones/{zone_id}/dns_records?name=subdomain&type=A to get record_id
  3. PUT /zones/{zone_id}/dns_records/{record_id} with ALL fields
  • Requires Cloudflare Partner Program membership
  • Reuses existing Cloudflare API token — connect Cloudflare first
  • Tenant account_id is different from your partner account_id
ID TypeFormatExample
Zone ID32-char hexa1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6
Account ID32-char hexb2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7
DNS Record ID32-char hexc3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8
Worker Script NameHuman-readable stringmy-worker-script
  • “List all DNS records for example.com”
  • “Update the A record for api.example.com to 192.168.1.1”
  • “List my Cloudflare zones”
  • “Deploy a Workers script”
  • “Create a KV namespace”
LimitValue
Global1,200 requests/5 minutes
KV writes1 write/second per key
Workers invocationsPlan-dependent