How to: Disable IPv6 in Cloudflare and make it always return IPv4
Work.ink uses this setting, if you want to match IPs with the ones our APIs use, you will need to change this setting accordingly.
To disable IPv6 for a domain in Cloudflare via their API, you use the PATCH endpoint for the zone setting ipv6. Here's how:
Endpoint:
PATCH https://api.cloudflare.com/client/v4/zones/{zone_id}/settings/ipv6cURL example:
curl -X PATCH "https://api.cloudflare.com/client/v4/zones/YOUR_ZONE_ID/settings/ipv6" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
--data '{"value":"off"}'Steps to get the required values:
- API Token — Create one in the Cloudflare dashboard under My Profile → API Tokens. It needs the
Zone.Settings.Editpermission. - Zone ID — Find it on the domain's overview page in the Cloudflare dashboard (right sidebar), or fetch it via the API:
curl -X GET "https://api.cloudflare.com/client/v4/zones?name=example.com" \
-H "Authorization: Bearer YOUR_API_TOKEN"The id field in the response is your zone ID.
Verify it worked by reading the setting back:
curl -X GET "https://api.cloudflare.com/client/v4/zones/YOUR_ZONE_ID/settings/ipv6" \
-H "Authorization: Bearer YOUR_API_TOKEN"The response should show "value": "off".
Note: Disabling IPv6 means Cloudflare will stop returning AAAA records for your domain. This is only available on certain Cloudflare plans — free plans may not allow toggling this setting. If you get a permissions error, check your plan level.