Update DNS Record
Update an existing DNS record.
Notes:
- A/AAAA records cannot exist on the same name as CNAME records.
- NS records cannot exist on the same name as any other record type.
- Domain names are always represented in Punycode, even if Unicode characters were used when creating the record.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYYAPI Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
X-Auth-Email: user@example.comThe previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194Accepted Permissions (at least one required)
DNS WriteReturnsExpand Collapse
RecordResponse = ARecord { id, created_on, meta, 4 more } | AAAARecord { id, created_on, meta, 4 more } | CNAMERecord { id, created_on, meta, 4 more } | 18 more
meta: Meta { dead_glue, is_glue, shadowed_by, shadowed_records_count } Extra Cloudflare-specific metadata about the record.
Extra Cloudflare-specific metadata about the record.
Whether this glue record is not served because a shallower NS delegation takes precedence over the deeper delegation that needs it. Present only when true; reachable glue carries only is_glue. See Unreachable glue records.
Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.
IDs of the NS records that shadow this record. See Shadowed records.
Number of records shadowed by this NS delegation. See Shadowed records.
meta: Meta { dead_glue, is_glue, shadowed_by, shadowed_records_count } Extra Cloudflare-specific metadata about the record.
Extra Cloudflare-specific metadata about the record.
Whether this glue record is not served because a shallower NS delegation takes precedence over the deeper delegation that needs it. Present only when true; reachable glue carries only is_glue. See Unreachable glue records.
Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.
IDs of the NS records that shadow this record. See Shadowed records.
Number of records shadowed by this NS delegation. See Shadowed records.
meta: Meta { dead_glue, is_glue, shadowed_by, shadowed_records_count } Extra Cloudflare-specific metadata about the record.
Extra Cloudflare-specific metadata about the record.
Whether this glue record is not served because a shallower NS delegation takes precedence over the deeper delegation that needs it. Present only when true; reachable glue carries only is_glue. See Unreachable glue records.
Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.
IDs of the NS records that shadow this record. See Shadowed records.
Number of records shadowed by this NS delegation. See Shadowed records.
meta: Meta { dead_glue, is_glue, shadowed_by, shadowed_records_count } Extra Cloudflare-specific metadata about the record.
Extra Cloudflare-specific metadata about the record.
Whether this glue record is not served because a shallower NS delegation takes precedence over the deeper delegation that needs it. Present only when true; reachable glue carries only is_glue. See Unreachable glue records.
Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.
IDs of the NS records that shadow this record. See Shadowed records.
Number of records shadowed by this NS delegation. See Shadowed records.
meta: Meta { dead_glue, is_glue, shadowed_by, shadowed_records_count } Extra Cloudflare-specific metadata about the record.
Extra Cloudflare-specific metadata about the record.
Whether this glue record is not served because a shallower NS delegation takes precedence over the deeper delegation that needs it. Present only when true; reachable glue carries only is_glue. See Unreachable glue records.
Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.
IDs of the NS records that shadow this record. See Shadowed records.
Number of records shadowed by this NS delegation. See Shadowed records.
OpenpgpkeyRecord { id, comment, content, 12 more }
meta: Meta { dead_glue, is_glue, shadowed_by, shadowed_records_count } Extra Cloudflare-specific metadata about the record.
Extra Cloudflare-specific metadata about the record.
Whether this glue record is not served because a shallower NS delegation takes precedence over the deeper delegation that needs it. Present only when true; reachable glue carries only is_glue. See Unreachable glue records.
Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.
IDs of the NS records that shadow this record. See Shadowed records.
Number of records shadowed by this NS delegation. See Shadowed records.
Whether the record is receiving the performance and security benefits of Cloudflare.
settings: Settings { ipv4_only, ipv6_only } Settings for the DNS record.
Settings for the DNS record.
Time To Live (TTL) of the DNS record in seconds. Setting to 1 means ‘automatic’. Value must be between 60 and 86400, with the minimum reduced to 30 for Enterprise zones.
Time To Live (TTL) of the DNS record in seconds. Setting to 1 means ‘automatic’. Value must be between 60 and 86400, with the minimum reduced to 30 for Enterprise zones.
meta: Meta { dead_glue, is_glue, shadowed_by, shadowed_records_count } Extra Cloudflare-specific metadata about the record.
Extra Cloudflare-specific metadata about the record.
Whether this glue record is not served because a shallower NS delegation takes precedence over the deeper delegation that needs it. Present only when true; reachable glue carries only is_glue. See Unreachable glue records.
Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.
IDs of the NS records that shadow this record. See Shadowed records.
Number of records shadowed by this NS delegation. See Shadowed records.
meta: Meta { dead_glue, is_glue, shadowed_by, shadowed_records_count } Extra Cloudflare-specific metadata about the record.
Extra Cloudflare-specific metadata about the record.
Whether this glue record is not served because a shallower NS delegation takes precedence over the deeper delegation that needs it. Present only when true; reachable glue carries only is_glue. See Unreachable glue records.
Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.
IDs of the NS records that shadow this record. See Shadowed records.
Number of records shadowed by this NS delegation. See Shadowed records.
meta: Meta { dead_glue, is_glue, shadowed_by, shadowed_records_count } Extra Cloudflare-specific metadata about the record.
Extra Cloudflare-specific metadata about the record.
Whether this glue record is not served because a shallower NS delegation takes precedence over the deeper delegation that needs it. Present only when true; reachable glue carries only is_glue. See Unreachable glue records.
Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.
IDs of the NS records that shadow this record. See Shadowed records.
Number of records shadowed by this NS delegation. See Shadowed records.
meta: Meta { dead_glue, is_glue, shadowed_by, shadowed_records_count } Extra Cloudflare-specific metadata about the record.
Extra Cloudflare-specific metadata about the record.
Whether this glue record is not served because a shallower NS delegation takes precedence over the deeper delegation that needs it. Present only when true; reachable glue carries only is_glue. See Unreachable glue records.
Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.
IDs of the NS records that shadow this record. See Shadowed records.
Number of records shadowed by this NS delegation. See Shadowed records.
meta: Meta { dead_glue, is_glue, shadowed_by, shadowed_records_count } Extra Cloudflare-specific metadata about the record.
Extra Cloudflare-specific metadata about the record.
Whether this glue record is not served because a shallower NS delegation takes precedence over the deeper delegation that needs it. Present only when true; reachable glue carries only is_glue. See Unreachable glue records.
Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.
IDs of the NS records that shadow this record. See Shadowed records.
Number of records shadowed by this NS delegation. See Shadowed records.
meta: Meta { dead_glue, is_glue, shadowed_by, shadowed_records_count } Extra Cloudflare-specific metadata about the record.
Extra Cloudflare-specific metadata about the record.
Whether this glue record is not served because a shallower NS delegation takes precedence over the deeper delegation that needs it. Present only when true; reachable glue carries only is_glue. See Unreachable glue records.
Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.
IDs of the NS records that shadow this record. See Shadowed records.
Number of records shadowed by this NS delegation. See Shadowed records.
meta: Meta { dead_glue, is_glue, shadowed_by, shadowed_records_count } Extra Cloudflare-specific metadata about the record.
Extra Cloudflare-specific metadata about the record.
Whether this glue record is not served because a shallower NS delegation takes precedence over the deeper delegation that needs it. Present only when true; reachable glue carries only is_glue. See Unreachable glue records.
Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.
IDs of the NS records that shadow this record. See Shadowed records.
Number of records shadowed by this NS delegation. See Shadowed records.
meta: Meta { dead_glue, is_glue, shadowed_by, shadowed_records_count } Extra Cloudflare-specific metadata about the record.
Extra Cloudflare-specific metadata about the record.
Whether this glue record is not served because a shallower NS delegation takes precedence over the deeper delegation that needs it. Present only when true; reachable glue carries only is_glue. See Unreachable glue records.
Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.
IDs of the NS records that shadow this record. See Shadowed records.
Number of records shadowed by this NS delegation. See Shadowed records.
meta: Meta { dead_glue, is_glue, shadowed_by, shadowed_records_count } Extra Cloudflare-specific metadata about the record.
Extra Cloudflare-specific metadata about the record.
Whether this glue record is not served because a shallower NS delegation takes precedence over the deeper delegation that needs it. Present only when true; reachable glue carries only is_glue. See Unreachable glue records.
Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.
IDs of the NS records that shadow this record. See Shadowed records.
Number of records shadowed by this NS delegation. See Shadowed records.
meta: Meta { dead_glue, is_glue, shadowed_by, shadowed_records_count } Extra Cloudflare-specific metadata about the record.
Extra Cloudflare-specific metadata about the record.
Whether this glue record is not served because a shallower NS delegation takes precedence over the deeper delegation that needs it. Present only when true; reachable glue carries only is_glue. See Unreachable glue records.
Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.
IDs of the NS records that shadow this record. See Shadowed records.
Number of records shadowed by this NS delegation. See Shadowed records.
meta: Meta { dead_glue, is_glue, shadowed_by, shadowed_records_count } Extra Cloudflare-specific metadata about the record.
Extra Cloudflare-specific metadata about the record.
Whether this glue record is not served because a shallower NS delegation takes precedence over the deeper delegation that needs it. Present only when true; reachable glue carries only is_glue. See Unreachable glue records.
Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.
IDs of the NS records that shadow this record. See Shadowed records.
Number of records shadowed by this NS delegation. See Shadowed records.
meta: Meta { dead_glue, is_glue, shadowed_by, shadowed_records_count } Extra Cloudflare-specific metadata about the record.
Extra Cloudflare-specific metadata about the record.
Whether this glue record is not served because a shallower NS delegation takes precedence over the deeper delegation that needs it. Present only when true; reachable glue carries only is_glue. See Unreachable glue records.
Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.
IDs of the NS records that shadow this record. See Shadowed records.
Number of records shadowed by this NS delegation. See Shadowed records.
meta: Meta { dead_glue, is_glue, shadowed_by, shadowed_records_count } Extra Cloudflare-specific metadata about the record.
Extra Cloudflare-specific metadata about the record.
Whether this glue record is not served because a shallower NS delegation takes precedence over the deeper delegation that needs it. Present only when true; reachable glue carries only is_glue. See Unreachable glue records.
Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.
IDs of the NS records that shadow this record. See Shadowed records.
Number of records shadowed by this NS delegation. See Shadowed records.
meta: Meta { dead_glue, is_glue, shadowed_by, shadowed_records_count } Extra Cloudflare-specific metadata about the record.
Extra Cloudflare-specific metadata about the record.
Whether this glue record is not served because a shallower NS delegation takes precedence over the deeper delegation that needs it. Present only when true; reachable glue carries only is_glue. See Unreachable glue records.
Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.
IDs of the NS records that shadow this record. See Shadowed records.
Number of records shadowed by this NS delegation. See Shadowed records.
meta: Meta { dead_glue, is_glue, shadowed_by, shadowed_records_count } Extra Cloudflare-specific metadata about the record.
Extra Cloudflare-specific metadata about the record.
Whether this glue record is not served because a shallower NS delegation takes precedence over the deeper delegation that needs it. Present only when true; reachable glue carries only is_glue. See Unreachable glue records.
Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.
IDs of the NS records that shadow this record. See Shadowed records.
Number of records shadowed by this NS delegation. See Shadowed records.
Update DNS Record
import Cloudflare from 'cloudflare';
const client = new Cloudflare({
apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted
});
const recordResponse = await client.dns.records.edit('023e105f4ecef8ad9ca31a8372d0c353', {
zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
name: 'example.com',
ttl: 3600,
type: 'A',
});
console.log(recordResponse);{
"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": {
"name": "example.com",
"ttl": 3600,
"type": "A",
"comment": "Domain verification record",
"content": "198.51.100.4",
"private_routing": true,
"proxied": true,
"settings": {
"ipv4_only": true,
"ipv6_only": true
},
"tags": [
"owner:dns-team"
],
"id": "023e105f4ecef8ad9ca31a8372d0c353",
"created_on": "2014-01-01T05:20:00.12345Z",
"meta": {
"dead_glue": true,
"is_glue": true,
"shadowed_by": [
"372e67954025e0ba6aaa6d586b9e0b59"
],
"shadowed_records_count": 42
},
"modified_on": "2014-01-01T05:20:00.12345Z",
"proxiable": true,
"comment_modified_on": "2024-01-01T05:20:00.12345Z",
"tags_modified_on": "2025-01-01T05:20:00.12345Z"
}
}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": {
"name": "example.com",
"ttl": 3600,
"type": "A",
"comment": "Domain verification record",
"content": "198.51.100.4",
"private_routing": true,
"proxied": true,
"settings": {
"ipv4_only": true,
"ipv6_only": true
},
"tags": [
"owner:dns-team"
],
"id": "023e105f4ecef8ad9ca31a8372d0c353",
"created_on": "2014-01-01T05:20:00.12345Z",
"meta": {
"dead_glue": true,
"is_glue": true,
"shadowed_by": [
"372e67954025e0ba6aaa6d586b9e0b59"
],
"shadowed_records_count": 42
},
"modified_on": "2014-01-01T05:20:00.12345Z",
"proxiable": true,
"comment_modified_on": "2024-01-01T05:20:00.12345Z",
"tags_modified_on": "2025-01-01T05:20:00.12345Z"
}
}