Build your own Dynamic DNS service using the CF API

My third-party DDNS account stopped working recently.
It seems CF has moved to a new API (v4).

The very good news is you can ditch the third-party and simply run a DDNS shell script as a cron job every minute on your webserver, calling the new CF API directly.


Yep, yours is way better than relying on a third party service.

I use a similar script, but for the IP address on an eth port so I end up with an internal address in my domain. It uses an ifconfig command, I believe.

In your script, I tried dig +short, but the result was blank. When I use the curl command, it does return my IP address like so: 0.061256 | connect: 0.153074 | appconnect: 0.387071 | pretransfer: 0.387107 | starttransfer: 0.484302 | total: 0.484332 | size: 13

Is this the behavior you were expecting?


dig works as expected on my network, but thanks for pointing out it may not on other configurations. I removed it from the posted code for the sake of simplicity. The time difference is really only a few seconds.

I know this post will attract some attention - there must be a lot of folks out there whose DDNS services suddenly just stopped working on CF due to the API upgrade (which was announced and scheduled years ago).


Looks great. I was using DynDNS for one of our setups but looks like I could just move to CF based solution and need not rely on other services. BTW could you maybe put this up on GitHub?

You can also add it to awesome-Cloudflare as well.

There are a few other solutions. One of them is written in bash too and others are in other languages (tho it may be using old API I think).

Thanks for sharing!

1 Like

With Oracle announcing it’s nuking Dyn next May, It’s a good time to start this discussion!


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.