Solved: Unable to set TTL with API for AAAA record

Dear all, I use a bash script to change the A and AAAA records of a subdomain on CF.

update4=$(curl -s -X PUT "https://api.cloudflare.com/client/v4/zones/$zone_identifier/dns_records/$record4_identifier" \
-H "X-Auth-Email: $auth_email" \
-H "$auth_header $auth_key" \
-H "Content-Type: application/json" \
--data "{\"id\":\"$zone_identifier\",\"type\":\"A\",\"proxied\":false,\"ttl\":\"1\",\"name\":\"$record_name\",\"content\":\"$ip4\"}")

this snipped correctly sets the TTL to 1 min. However the similar snipped for AAAA does not work the same way:

update6=$(curl -s -X PUT "https://api.cloudflare.com/client/v4/zones/$zone_identifier/dns_records/$record6_id" \
-H "X-Auth-Email: $auth_email" \
-H "X-Auth-Key: $auth_key" \
-H "Content-Type: application/json" \
--data "{\"id\":\"$zone_identifier\",\"type\":\"AAAA\",\"proxied\":false,\"ttl\":\"1\",\"name\":\"$record_name\",\"content\":\"$ipv6\"}")

This sets the TTL for the AAAA record to β€œAuto” and not 1 min. What am I doing wrong here?

ttl is seconds, not minutes, so the value should be β€œ60”. β€œ1” sets it to automatic and should actually do the same for the A record.

2 Likes

Plus, it should be a number, not a string.

Thank you. So it should read ,\"ttl\":60
Thank worked for me!

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