Update DNS Settings
Update DNS settings for a zone
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Accepted Permissions (at least one required)
Body ParametersJSON
Whether to flatten all CNAME records in the zone. Note that, due to DNS limitations, a CNAME record at the zone apex will always be flattened.
Whether to enable multi-provider DNS, which causes Cloudflare to activate the zone even when non-Cloudflare NS records exist, and to respect NS records at the zone apex during outbound zone transfers.
The time to live (TTL) of the zone’s nameserver (NS) records.
Update DNS Settings
curl https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_settings \
-X PATCH \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
-d '{
"ns_ttl": 86400,
"zone_mode": "dns_only"
}'{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": {
"flatten_all_cnames": false,
"foundation_dns": false,
"internal_dns": {
"reference_zone_id": "reference_zone_id"
},
"multi_provider": false,
"nameservers": {
"type": "cloudflare.standard",
"ns_set": 1
},
"ns_ttl": 86400,
"secondary_overrides": false,
"soa": {
"expire": 604800,
"min_ttl": 1800,
"mname": "kristina.ns.cloudflare.com",
"refresh": 10000,
"retry": 2400,
"rname": "admin.example.com",
"ttl": 3600
},
"zone_mode": "dns_only"
}
}Returns Examples
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": {
"flatten_all_cnames": false,
"foundation_dns": false,
"internal_dns": {
"reference_zone_id": "reference_zone_id"
},
"multi_provider": false,
"nameservers": {
"type": "cloudflare.standard",
"ns_set": 1
},
"ns_ttl": 86400,
"secondary_overrides": false,
"soa": {
"expire": 604800,
"min_ttl": 1800,
"mname": "kristina.ns.cloudflare.com",
"refresh": 10000,
"retry": 2400,
"rname": "admin.example.com",
"ttl": 3600
},
"zone_mode": "dns_only"
}
}