How can I programmatically retrieve the latest Cloudflare IP addresses for automation?

Question

Grade: Education Subject: Support
How can I programmatically retrieve the latest Cloudflare IP addresses for automation?
Asked by:
86 Viewed 86 Answers

Answer (86)

Best Answer
(352)
You can programmatically retrieve the latest Cloudflare IP addresses by making HTTP requests to `https://www.cloudflare.com/ips-v4` and `https://www.cloudflare.com/ips-v6`. Parse the JSON response to extract the IPv4 and IPv6 address ranges. You can then use these ranges in scripts or applications for tasks like firewall rule updates or log analysis.