Summary
Add Cloudflare as a built-in provider under Network > WAN > Dynamic DNS. Cloudflare DNS is free and very widely used, but its API needs a Bearer token, so it can’t be set up with the existing Custom URL option. Today we run external updaters that can’t see Peplink WAN state. Many of us also pay for No-IP or DynDNS purely to CNAME our Cloudflare domain to it.
UI (mockup attached)
This fits into the existing Dynamic DNS form. Only four new fields are needed:
- Service provider: add “Cloudflare (API token)” to the existing dropdown
- API token (new): password field plus a Verify button
- Zone (new): dropdown filled automatically once the token is verified
- Hostname(s): existing field
- Record type: A / AAAA checkboxes
- Proxied (new): on/off
- TTL: 60s default, or Auto
- Update mode (new): This WAN only / Follow active WAN (failover) / All healthy WANs
The status table and Event Log reuse what already exists.
Why “Follow active WAN” matters
Only the router knows WAN health. Updating one hostname to the highest-priority healthy WAN on failover and failback gives inbound failover that no external DDNS client can provide.
Implementation: four HTTPS calls, Bearer auth, JSON
Base URL: https://api.cloudflare.com/client/v4
Header: Authorization: Bearer
- Verify token (on Save / Verify button):
GET /user/tokens/verify - Resolve zone ID (cache it):
GET /zones?name=example.com → result[0].id - Find the record (cache its ID):
GET /zones/<zone_id>/dns_records?type=A&name=home.example.com
4a. Update if it exists:
PATCH /zones/<zone_id>/dns_records/<record_id>
{“content”:“203.0.113.24”,“ttl”:60,“proxied”:false}
4b. Create if not:
POST /zones/<zone_id>/dns_records
{“type”:“A”,“name”:“home.example.com”,“content”:“203.0.113.24”,“ttl”:60,“proxied”:false}
Every response has “success”: true/false plus an “errors” array to show in the status table and log.
Reference logic (shell, for illustration):
API=https://api.cloudflare.com/client/v4
H=“Authorization: Bearer $TOKEN”
ZID=$(curl -s -H “$H” “$API/zones?name=$ZONE” | jq -r ‘.result[0].id’)
REC=$(curl -s -H “$H” “$API/zones/$ZID/dns_records?type=A&name=$HOST”)
RID=$(echo “$REC” | jq -r ‘.result[0].id // empty’)
CUR=$(echo “$REC” | jq -r ‘.result[0].content // empty’)
[ “$CUR” = “$WAN_IP” ] && exit 0
BODY=“{“type”:“A”,“name”:“$HOST”,“content”:“$WAN_IP”,“ttl”:60,“proxied”:false}”
if [ -n “$RID” ]; then
curl -s -X PATCH -H “$H” -H ‘Content-Type: application/json’ -d “$BODY” “$API/zones/$ZID/dns_records/$RID”
else
curl -s -X POST -H “$H” -H ‘Content-Type: application/json’ -d “$BODY” “$API/zones/$ZID/dns_records”
fi
Triggers: reuse the existing hooks
- WAN IP change (as today’s providers do)
- WAN health-check up/down events (for the two failover modes)
- Periodic reconcile, e.g. every 30 minutes, which skips the write if the IP hasn’t changed
Only ever touch records the router manages.
API documentation
- Update DNS record: Update DNS Record | Cloudflare API
- Full API reference: API Reference | Cloudflare API
To test: create a token at dash.cloudflare.com > My Profile > API Tokens with the “Edit zone DNS” template, limited to one zone.
Minimum alternative
If a native provider isn’t feasible, extend Custom Dynamic DNS to allow a chosen HTTP method (PATCH/POST), custom headers (Authorization: Bearer), and a JSON body with an IP placeholder. That alone would unlock Cloudflare and most other API-based DNS providers.
Thanks,
Matt Jones

