## Overwrite DNS Record `client.DNS.Records.Update(ctx, dnsRecordID, params) (*RecordResponse, error)` **put** `/zones/{zone_id}/dns_records/{dns_record_id}` Overwrite 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. ### Parameters - `dnsRecordID string` Identifier. - `params RecordUpdateParams` - `ZoneID param.Field[string]` Path param: Identifier. - `ARecord param.Field[ARecord]` Body param ### Returns - `type RecordResponse interface{…}` - `type RecordResponseA struct{…}` - `ID string` Identifier. - `CreatedOn Time` When the record was created. - `Meta unknown` Extra Cloudflare-specific information about the record. - `ModifiedOn Time` When the record was last modified. - `Proxiable bool` Whether the record can be proxied by Cloudflare or not. - `CommentModifiedOn Time` When the record comment was last modified. Omitted if there is no comment. - `TagsModifiedOn Time` When the record tags were last modified. Omitted if there are no tags. - `type RecordResponseAAAA struct{…}` - `ID string` Identifier. - `CreatedOn Time` When the record was created. - `Meta unknown` Extra Cloudflare-specific information about the record. - `ModifiedOn Time` When the record was last modified. - `Proxiable bool` Whether the record can be proxied by Cloudflare or not. - `CommentModifiedOn Time` When the record comment was last modified. Omitted if there is no comment. - `TagsModifiedOn Time` When the record tags were last modified. Omitted if there are no tags. - `type RecordResponseCNAME struct{…}` - `ID string` Identifier. - `CreatedOn Time` When the record was created. - `Meta unknown` Extra Cloudflare-specific information about the record. - `ModifiedOn Time` When the record was last modified. - `Proxiable bool` Whether the record can be proxied by Cloudflare or not. - `CommentModifiedOn Time` When the record comment was last modified. Omitted if there is no comment. - `TagsModifiedOn Time` When the record tags were last modified. Omitted if there are no tags. - `type RecordResponseMX struct{…}` - `ID string` Identifier. - `CreatedOn Time` When the record was created. - `Meta unknown` Extra Cloudflare-specific information about the record. - `ModifiedOn Time` When the record was last modified. - `Proxiable bool` Whether the record can be proxied by Cloudflare or not. - `CommentModifiedOn Time` When the record comment was last modified. Omitted if there is no comment. - `TagsModifiedOn Time` When the record tags were last modified. Omitted if there are no tags. - `type RecordResponseNS struct{…}` - `ID string` Identifier. - `CreatedOn Time` When the record was created. - `Meta unknown` Extra Cloudflare-specific information about the record. - `ModifiedOn Time` When the record was last modified. - `Proxiable bool` Whether the record can be proxied by Cloudflare or not. - `CommentModifiedOn Time` When the record comment was last modified. Omitted if there is no comment. - `TagsModifiedOn Time` When the record tags were last modified. Omitted if there are no tags. - `type RecordResponseOpenpgpkey struct{…}` - `ID string` Identifier. - `Comment string` Comments or notes about the DNS record. This field has no effect on DNS responses. - `Content string` A single Base64-encoded OpenPGP Transferable Public Key (RFC 4880 Section 11.1) - `CreatedOn Time` When the record was created. - `Meta unknown` Extra Cloudflare-specific information about the record. - `ModifiedOn Time` When the record was last modified. - `Name string` Complete DNS record name, including the zone name, in Punycode. - `Proxiable bool` Whether the record can be proxied by Cloudflare or not. - `Proxied bool` Whether the record is receiving the performance and security benefits of Cloudflare. - `Settings RecordResponseOpenpgpkeySettings` Settings for the DNS record. - `IPV4Only bool` When enabled, only A records will be generated, and AAAA records will not be created. This setting is intended for exceptional cases. Note that this option only applies to proxied records and it has no effect on whether Cloudflare communicates with the origin using IPv4 or IPv6. - `IPV6Only bool` When enabled, only AAAA records will be generated, and A records will not be created. This setting is intended for exceptional cases. Note that this option only applies to proxied records and it has no effect on whether Cloudflare communicates with the origin using IPv4 or IPv6. - `Tags []RecordTags` Custom tags for the DNS record. This field has no effect on DNS responses. - `TTL TTL` 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. - `float64` - `type TTL float64` 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. - `const TTL1 TTL = 1` - `Type RecordResponseOpenpgpkeyType` Record type. - `const RecordResponseOpenpgpkeyTypeOpenpgpkey RecordResponseOpenpgpkeyType = "OPENPGPKEY"` - `CommentModifiedOn Time` When the record comment was last modified. Omitted if there is no comment. - `TagsModifiedOn Time` When the record tags were last modified. Omitted if there are no tags. - `type RecordResponsePTR struct{…}` - `ID string` Identifier. - `CreatedOn Time` When the record was created. - `Meta unknown` Extra Cloudflare-specific information about the record. - `ModifiedOn Time` When the record was last modified. - `Proxiable bool` Whether the record can be proxied by Cloudflare or not. - `CommentModifiedOn Time` When the record comment was last modified. Omitted if there is no comment. - `TagsModifiedOn Time` When the record tags were last modified. Omitted if there are no tags. - `type RecordResponseTXT struct{…}` - `ID string` Identifier. - `CreatedOn Time` When the record was created. - `Meta unknown` Extra Cloudflare-specific information about the record. - `ModifiedOn Time` When the record was last modified. - `Proxiable bool` Whether the record can be proxied by Cloudflare or not. - `CommentModifiedOn Time` When the record comment was last modified. Omitted if there is no comment. - `TagsModifiedOn Time` When the record tags were last modified. Omitted if there are no tags. - `type RecordResponseCAA struct{…}` - `ID string` Identifier. - `CreatedOn Time` When the record was created. - `Meta unknown` Extra Cloudflare-specific information about the record. - `ModifiedOn Time` When the record was last modified. - `Proxiable bool` Whether the record can be proxied by Cloudflare or not. - `CommentModifiedOn Time` When the record comment was last modified. Omitted if there is no comment. - `TagsModifiedOn Time` When the record tags were last modified. Omitted if there are no tags. - `type RecordResponseCERT struct{…}` - `ID string` Identifier. - `CreatedOn Time` When the record was created. - `Meta unknown` Extra Cloudflare-specific information about the record. - `ModifiedOn Time` When the record was last modified. - `Proxiable bool` Whether the record can be proxied by Cloudflare or not. - `CommentModifiedOn Time` When the record comment was last modified. Omitted if there is no comment. - `TagsModifiedOn Time` When the record tags were last modified. Omitted if there are no tags. - `type RecordResponseDNSKEY struct{…}` - `ID string` Identifier. - `CreatedOn Time` When the record was created. - `Meta unknown` Extra Cloudflare-specific information about the record. - `ModifiedOn Time` When the record was last modified. - `Proxiable bool` Whether the record can be proxied by Cloudflare or not. - `CommentModifiedOn Time` When the record comment was last modified. Omitted if there is no comment. - `TagsModifiedOn Time` When the record tags were last modified. Omitted if there are no tags. - `type RecordResponseDS struct{…}` - `ID string` Identifier. - `CreatedOn Time` When the record was created. - `Meta unknown` Extra Cloudflare-specific information about the record. - `ModifiedOn Time` When the record was last modified. - `Proxiable bool` Whether the record can be proxied by Cloudflare or not. - `CommentModifiedOn Time` When the record comment was last modified. Omitted if there is no comment. - `TagsModifiedOn Time` When the record tags were last modified. Omitted if there are no tags. - `type RecordResponseHTTPS struct{…}` - `ID string` Identifier. - `CreatedOn Time` When the record was created. - `Meta unknown` Extra Cloudflare-specific information about the record. - `ModifiedOn Time` When the record was last modified. - `Proxiable bool` Whether the record can be proxied by Cloudflare or not. - `CommentModifiedOn Time` When the record comment was last modified. Omitted if there is no comment. - `TagsModifiedOn Time` When the record tags were last modified. Omitted if there are no tags. - `type RecordResponseLOC struct{…}` - `ID string` Identifier. - `CreatedOn Time` When the record was created. - `Meta unknown` Extra Cloudflare-specific information about the record. - `ModifiedOn Time` When the record was last modified. - `Proxiable bool` Whether the record can be proxied by Cloudflare or not. - `CommentModifiedOn Time` When the record comment was last modified. Omitted if there is no comment. - `TagsModifiedOn Time` When the record tags were last modified. Omitted if there are no tags. - `type RecordResponseNAPTR struct{…}` - `ID string` Identifier. - `CreatedOn Time` When the record was created. - `Meta unknown` Extra Cloudflare-specific information about the record. - `ModifiedOn Time` When the record was last modified. - `Proxiable bool` Whether the record can be proxied by Cloudflare or not. - `CommentModifiedOn Time` When the record comment was last modified. Omitted if there is no comment. - `TagsModifiedOn Time` When the record tags were last modified. Omitted if there are no tags. - `type RecordResponseSMIMEA struct{…}` - `ID string` Identifier. - `CreatedOn Time` When the record was created. - `Meta unknown` Extra Cloudflare-specific information about the record. - `ModifiedOn Time` When the record was last modified. - `Proxiable bool` Whether the record can be proxied by Cloudflare or not. - `CommentModifiedOn Time` When the record comment was last modified. Omitted if there is no comment. - `TagsModifiedOn Time` When the record tags were last modified. Omitted if there are no tags. - `type RecordResponseSRV struct{…}` - `ID string` Identifier. - `CreatedOn Time` When the record was created. - `Meta unknown` Extra Cloudflare-specific information about the record. - `ModifiedOn Time` When the record was last modified. - `Proxiable bool` Whether the record can be proxied by Cloudflare or not. - `CommentModifiedOn Time` When the record comment was last modified. Omitted if there is no comment. - `TagsModifiedOn Time` When the record tags were last modified. Omitted if there are no tags. - `type RecordResponseSSHFP struct{…}` - `ID string` Identifier. - `CreatedOn Time` When the record was created. - `Meta unknown` Extra Cloudflare-specific information about the record. - `ModifiedOn Time` When the record was last modified. - `Proxiable bool` Whether the record can be proxied by Cloudflare or not. - `CommentModifiedOn Time` When the record comment was last modified. Omitted if there is no comment. - `TagsModifiedOn Time` When the record tags were last modified. Omitted if there are no tags. - `type RecordResponseSVCB struct{…}` - `ID string` Identifier. - `CreatedOn Time` When the record was created. - `Meta unknown` Extra Cloudflare-specific information about the record. - `ModifiedOn Time` When the record was last modified. - `Proxiable bool` Whether the record can be proxied by Cloudflare or not. - `CommentModifiedOn Time` When the record comment was last modified. Omitted if there is no comment. - `TagsModifiedOn Time` When the record tags were last modified. Omitted if there are no tags. - `type RecordResponseTLSA struct{…}` - `ID string` Identifier. - `CreatedOn Time` When the record was created. - `Meta unknown` Extra Cloudflare-specific information about the record. - `ModifiedOn Time` When the record was last modified. - `Proxiable bool` Whether the record can be proxied by Cloudflare or not. - `CommentModifiedOn Time` When the record comment was last modified. Omitted if there is no comment. - `TagsModifiedOn Time` When the record tags were last modified. Omitted if there are no tags. - `type RecordResponseURI struct{…}` - `ID string` Identifier. - `CreatedOn Time` When the record was created. - `Meta unknown` Extra Cloudflare-specific information about the record. - `ModifiedOn Time` When the record was last modified. - `Proxiable bool` Whether the record can be proxied by Cloudflare or not. - `CommentModifiedOn Time` When the record comment was last modified. Omitted if there is no comment. - `TagsModifiedOn Time` When the record tags were last modified. Omitted if there are no tags. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/dns" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) recordResponse, err := client.DNS.Records.Update( context.TODO(), "023e105f4ecef8ad9ca31a8372d0c353", dns.RecordUpdateParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Body: dns.ARecordParam{ Name: cloudflare.F("example.com"), TTL: cloudflare.F(dns.TTL1), Type: cloudflare.F(dns.ARecordTypeA), }, }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", recordResponse) } ``` #### Response ```json { "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": {}, "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" } } ```