This is a bit of a zombie page, but it comes up in Google searches, so I thought I would put the working example here.
If you go to the ddclient github page and browse the source code for ddclient.in, search for 'cloudflare' and you will see the examples and all the details on how to make this work with ddclient 3.9.1.
Option one: Use Global API key
Last stanza of ddclient.conf
#
# Change ip address for example.com at cloudflare
# (less secure as uses global API key)
#
protocol=cloudflare, \
zone=example.com, \
ttl=1, \
login=your_email_for [email protected], \
password=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \
example.com
The comma, space and line break are important. Be sure there are no spaces after the backward slash.
Option two: Use API token with limited permissions
a. Go to your Cloudflare dashboard and make a API token with Zone-DNS-Edit and Zone-Zone-Read permissions. It won't work if the permissions on the API Token are anything else.
b. Last stanza of ddclient.conf
#
# Using token with Zone-DNS-Edit and Zone-Zone-Read permissions
#
protocol=cloudflare, \
zone=example.com, \
ttl=1, \
login=token, \
password=XxXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \
example.com
Again, formatting seemed to be important. I got error messages when there were stray spaces after the backslash. If you use the token, it is sent as "Bearer xxxxxxxx." In ddclient, the "Bearer" is prepended automatically; you only need to put in the alphanum string. Read the perl source for more details.
Tested and working on OpenBSD 6.9 and 7.0 and ddclient 3.9.1.