Skip to content
Start here

Create DNS Record

client.DNS.Records.New(ctx, params) (*RecordResponse, error)
POST/zones/{zone_id}/dns_records

Create a new DNS record for a zone.

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.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
DNS Write
ParametersExpand Collapse
params RecordNewParams
ZoneID param.Field[string]

Path param: Identifier.

maxLength32
ARecord param.Field[ARecord]

Body param

IncludeShadowMetadata param.Field[bool]Optional

Query param: Whether to include shadow metadata in the meta field of each record in the response. See Shadowed records.

ReturnsExpand Collapse
type RecordResponse interface{…}
One of the following:
type RecordResponseARecord struct{…}
ID string

Identifier.

maxLength32
CreatedOn Time

When the record was created.

formatdate-time
Meta RecordResponseARecordMeta

Extra Cloudflare-specific metadata about the record.

DeadGlue boolOptional

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.

IsGlue boolOptional

Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.

ShadowedBy []stringOptional

IDs of the NS records that shadow this record. See Shadowed records.

ShadowedRecordsCount int64Optional

Number of records shadowed by this NS delegation. See Shadowed records.

maximum10000
minimum0
ModifiedOn Time

When the record was last modified.

formatdate-time
Proxiable bool

Whether the record can be proxied by Cloudflare or not.

CommentModifiedOn TimeOptional

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
TagsModifiedOn TimeOptional

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
type RecordResponseAAAARecord struct{…}
ID string

Identifier.

maxLength32
CreatedOn Time

When the record was created.

formatdate-time
Meta RecordResponseAAAARecordMeta

Extra Cloudflare-specific metadata about the record.

DeadGlue boolOptional

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.

IsGlue boolOptional

Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.

ShadowedBy []stringOptional

IDs of the NS records that shadow this record. See Shadowed records.

ShadowedRecordsCount int64Optional

Number of records shadowed by this NS delegation. See Shadowed records.

maximum10000
minimum0
ModifiedOn Time

When the record was last modified.

formatdate-time
Proxiable bool

Whether the record can be proxied by Cloudflare or not.

CommentModifiedOn TimeOptional

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
TagsModifiedOn TimeOptional

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
type RecordResponseCNAMERecord struct{…}
ID string

Identifier.

maxLength32
CreatedOn Time

When the record was created.

formatdate-time
Meta RecordResponseCNAMERecordMeta

Extra Cloudflare-specific metadata about the record.

DeadGlue boolOptional

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.

IsGlue boolOptional

Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.

ShadowedBy []stringOptional

IDs of the NS records that shadow this record. See Shadowed records.

ShadowedRecordsCount int64Optional

Number of records shadowed by this NS delegation. See Shadowed records.

maximum10000
minimum0
ModifiedOn Time

When the record was last modified.

formatdate-time
Proxiable bool

Whether the record can be proxied by Cloudflare or not.

CommentModifiedOn TimeOptional

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
TagsModifiedOn TimeOptional

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
type RecordResponseMXRecord struct{…}
ID string

Identifier.

maxLength32
CreatedOn Time

When the record was created.

formatdate-time
Meta RecordResponseMXRecordMeta

Extra Cloudflare-specific metadata about the record.

DeadGlue boolOptional

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.

IsGlue boolOptional

Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.

ShadowedBy []stringOptional

IDs of the NS records that shadow this record. See Shadowed records.

ShadowedRecordsCount int64Optional

Number of records shadowed by this NS delegation. See Shadowed records.

maximum10000
minimum0
ModifiedOn Time

When the record was last modified.

formatdate-time
Proxiable bool

Whether the record can be proxied by Cloudflare or not.

CommentModifiedOn TimeOptional

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
TagsModifiedOn TimeOptional

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
type RecordResponseNSRecord struct{…}
ID string

Identifier.

maxLength32
CreatedOn Time

When the record was created.

formatdate-time
Meta RecordResponseNSRecordMeta

Extra Cloudflare-specific metadata about the record.

DeadGlue boolOptional

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.

IsGlue boolOptional

Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.

ShadowedBy []stringOptional

IDs of the NS records that shadow this record. See Shadowed records.

ShadowedRecordsCount int64Optional

Number of records shadowed by this NS delegation. See Shadowed records.

maximum10000
minimum0
ModifiedOn Time

When the record was last modified.

formatdate-time
Proxiable bool

Whether the record can be proxied by Cloudflare or not.

CommentModifiedOn TimeOptional

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
TagsModifiedOn TimeOptional

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
type RecordResponseOpenpgpkeyRecord struct{…}
ID string

Identifier.

maxLength32
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.

formatdate-time
Meta RecordResponseOpenpgpkeyRecordMeta

Extra Cloudflare-specific metadata about the record.

DeadGlue boolOptional

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.

IsGlue boolOptional

Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.

ShadowedBy []stringOptional

IDs of the NS records that shadow this record. See Shadowed records.

ShadowedRecordsCount int64Optional

Number of records shadowed by this NS delegation. See Shadowed records.

maximum10000
minimum0
ModifiedOn Time

When the record was last modified.

formatdate-time
Name string

Complete DNS record name, including the zone name, in Punycode.

maxLength255
minLength1
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 RecordResponseOpenpgpkeyRecordSettings

Settings for the DNS record.

IPV4Only boolOptional

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 boolOptional

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.

One of the following:
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.

Type RecordResponseOpenpgpkeyRecordType

Record type.

CommentModifiedOn TimeOptional

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
TagsModifiedOn TimeOptional

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
type RecordResponsePTRRecord struct{…}
ID string

Identifier.

maxLength32
CreatedOn Time

When the record was created.

formatdate-time
Meta RecordResponsePTRRecordMeta

Extra Cloudflare-specific metadata about the record.

DeadGlue boolOptional

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.

IsGlue boolOptional

Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.

ShadowedBy []stringOptional

IDs of the NS records that shadow this record. See Shadowed records.

ShadowedRecordsCount int64Optional

Number of records shadowed by this NS delegation. See Shadowed records.

maximum10000
minimum0
ModifiedOn Time

When the record was last modified.

formatdate-time
Proxiable bool

Whether the record can be proxied by Cloudflare or not.

CommentModifiedOn TimeOptional

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
TagsModifiedOn TimeOptional

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
type RecordResponseTXTRecord struct{…}
ID string

Identifier.

maxLength32
CreatedOn Time

When the record was created.

formatdate-time
Meta RecordResponseTXTRecordMeta

Extra Cloudflare-specific metadata about the record.

DeadGlue boolOptional

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.

IsGlue boolOptional

Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.

ShadowedBy []stringOptional

IDs of the NS records that shadow this record. See Shadowed records.

ShadowedRecordsCount int64Optional

Number of records shadowed by this NS delegation. See Shadowed records.

maximum10000
minimum0
ModifiedOn Time

When the record was last modified.

formatdate-time
Proxiable bool

Whether the record can be proxied by Cloudflare or not.

CommentModifiedOn TimeOptional

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
TagsModifiedOn TimeOptional

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
type RecordResponseCAARecord struct{…}
ID string

Identifier.

maxLength32
CreatedOn Time

When the record was created.

formatdate-time
Meta RecordResponseCAARecordMeta

Extra Cloudflare-specific metadata about the record.

DeadGlue boolOptional

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.

IsGlue boolOptional

Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.

ShadowedBy []stringOptional

IDs of the NS records that shadow this record. See Shadowed records.

ShadowedRecordsCount int64Optional

Number of records shadowed by this NS delegation. See Shadowed records.

maximum10000
minimum0
ModifiedOn Time

When the record was last modified.

formatdate-time
Proxiable bool

Whether the record can be proxied by Cloudflare or not.

CommentModifiedOn TimeOptional

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
TagsModifiedOn TimeOptional

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
type RecordResponseCERTRecord struct{…}
ID string

Identifier.

maxLength32
CreatedOn Time

When the record was created.

formatdate-time
Meta RecordResponseCERTRecordMeta

Extra Cloudflare-specific metadata about the record.

DeadGlue boolOptional

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.

IsGlue boolOptional

Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.

ShadowedBy []stringOptional

IDs of the NS records that shadow this record. See Shadowed records.

ShadowedRecordsCount int64Optional

Number of records shadowed by this NS delegation. See Shadowed records.

maximum10000
minimum0
ModifiedOn Time

When the record was last modified.

formatdate-time
Proxiable bool

Whether the record can be proxied by Cloudflare or not.

CommentModifiedOn TimeOptional

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
TagsModifiedOn TimeOptional

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
type RecordResponseDNSKEYRecord struct{…}
ID string

Identifier.

maxLength32
CreatedOn Time

When the record was created.

formatdate-time
Meta RecordResponseDNSKEYRecordMeta

Extra Cloudflare-specific metadata about the record.

DeadGlue boolOptional

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.

IsGlue boolOptional

Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.

ShadowedBy []stringOptional

IDs of the NS records that shadow this record. See Shadowed records.

ShadowedRecordsCount int64Optional

Number of records shadowed by this NS delegation. See Shadowed records.

maximum10000
minimum0
ModifiedOn Time

When the record was last modified.

formatdate-time
Proxiable bool

Whether the record can be proxied by Cloudflare or not.

CommentModifiedOn TimeOptional

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
TagsModifiedOn TimeOptional

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
type RecordResponseDSRecord struct{…}
ID string

Identifier.

maxLength32
CreatedOn Time

When the record was created.

formatdate-time
Meta RecordResponseDSRecordMeta

Extra Cloudflare-specific metadata about the record.

DeadGlue boolOptional

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.

IsGlue boolOptional

Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.

ShadowedBy []stringOptional

IDs of the NS records that shadow this record. See Shadowed records.

ShadowedRecordsCount int64Optional

Number of records shadowed by this NS delegation. See Shadowed records.

maximum10000
minimum0
ModifiedOn Time

When the record was last modified.

formatdate-time
Proxiable bool

Whether the record can be proxied by Cloudflare or not.

CommentModifiedOn TimeOptional

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
TagsModifiedOn TimeOptional

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
type RecordResponseHTTPSRecord struct{…}
ID string

Identifier.

maxLength32
CreatedOn Time

When the record was created.

formatdate-time
Meta RecordResponseHTTPSRecordMeta

Extra Cloudflare-specific metadata about the record.

DeadGlue boolOptional

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.

IsGlue boolOptional

Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.

ShadowedBy []stringOptional

IDs of the NS records that shadow this record. See Shadowed records.

ShadowedRecordsCount int64Optional

Number of records shadowed by this NS delegation. See Shadowed records.

maximum10000
minimum0
ModifiedOn Time

When the record was last modified.

formatdate-time
Proxiable bool

Whether the record can be proxied by Cloudflare or not.

CommentModifiedOn TimeOptional

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
TagsModifiedOn TimeOptional

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
type RecordResponseLOCRecord struct{…}
ID string

Identifier.

maxLength32
CreatedOn Time

When the record was created.

formatdate-time
Meta RecordResponseLOCRecordMeta

Extra Cloudflare-specific metadata about the record.

DeadGlue boolOptional

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.

IsGlue boolOptional

Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.

ShadowedBy []stringOptional

IDs of the NS records that shadow this record. See Shadowed records.

ShadowedRecordsCount int64Optional

Number of records shadowed by this NS delegation. See Shadowed records.

maximum10000
minimum0
ModifiedOn Time

When the record was last modified.

formatdate-time
Proxiable bool

Whether the record can be proxied by Cloudflare or not.

CommentModifiedOn TimeOptional

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
TagsModifiedOn TimeOptional

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
type RecordResponseNAPTRRecord struct{…}
ID string

Identifier.

maxLength32
CreatedOn Time

When the record was created.

formatdate-time
Meta RecordResponseNAPTRRecordMeta

Extra Cloudflare-specific metadata about the record.

DeadGlue boolOptional

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.

IsGlue boolOptional

Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.

ShadowedBy []stringOptional

IDs of the NS records that shadow this record. See Shadowed records.

ShadowedRecordsCount int64Optional

Number of records shadowed by this NS delegation. See Shadowed records.

maximum10000
minimum0
ModifiedOn Time

When the record was last modified.

formatdate-time
Proxiable bool

Whether the record can be proxied by Cloudflare or not.

CommentModifiedOn TimeOptional

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
TagsModifiedOn TimeOptional

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
type RecordResponseSMIMEARecord struct{…}
ID string

Identifier.

maxLength32
CreatedOn Time

When the record was created.

formatdate-time
Meta RecordResponseSMIMEARecordMeta

Extra Cloudflare-specific metadata about the record.

DeadGlue boolOptional

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.

IsGlue boolOptional

Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.

ShadowedBy []stringOptional

IDs of the NS records that shadow this record. See Shadowed records.

ShadowedRecordsCount int64Optional

Number of records shadowed by this NS delegation. See Shadowed records.

maximum10000
minimum0
ModifiedOn Time

When the record was last modified.

formatdate-time
Proxiable bool

Whether the record can be proxied by Cloudflare or not.

CommentModifiedOn TimeOptional

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
TagsModifiedOn TimeOptional

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
type RecordResponseSRVRecord struct{…}
ID string

Identifier.

maxLength32
CreatedOn Time

When the record was created.

formatdate-time
Meta RecordResponseSRVRecordMeta

Extra Cloudflare-specific metadata about the record.

DeadGlue boolOptional

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.

IsGlue boolOptional

Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.

ShadowedBy []stringOptional

IDs of the NS records that shadow this record. See Shadowed records.

ShadowedRecordsCount int64Optional

Number of records shadowed by this NS delegation. See Shadowed records.

maximum10000
minimum0
ModifiedOn Time

When the record was last modified.

formatdate-time
Proxiable bool

Whether the record can be proxied by Cloudflare or not.

CommentModifiedOn TimeOptional

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
TagsModifiedOn TimeOptional

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
type RecordResponseSSHFPRecord struct{…}
ID string

Identifier.

maxLength32
CreatedOn Time

When the record was created.

formatdate-time
Meta RecordResponseSSHFPRecordMeta

Extra Cloudflare-specific metadata about the record.

DeadGlue boolOptional

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.

IsGlue boolOptional

Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.

ShadowedBy []stringOptional

IDs of the NS records that shadow this record. See Shadowed records.

ShadowedRecordsCount int64Optional

Number of records shadowed by this NS delegation. See Shadowed records.

maximum10000
minimum0
ModifiedOn Time

When the record was last modified.

formatdate-time
Proxiable bool

Whether the record can be proxied by Cloudflare or not.

CommentModifiedOn TimeOptional

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
TagsModifiedOn TimeOptional

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
type RecordResponseSVCBRecord struct{…}
ID string

Identifier.

maxLength32
CreatedOn Time

When the record was created.

formatdate-time
Meta RecordResponseSVCBRecordMeta

Extra Cloudflare-specific metadata about the record.

DeadGlue boolOptional

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.

IsGlue boolOptional

Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.

ShadowedBy []stringOptional

IDs of the NS records that shadow this record. See Shadowed records.

ShadowedRecordsCount int64Optional

Number of records shadowed by this NS delegation. See Shadowed records.

maximum10000
minimum0
ModifiedOn Time

When the record was last modified.

formatdate-time
Proxiable bool

Whether the record can be proxied by Cloudflare or not.

CommentModifiedOn TimeOptional

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
TagsModifiedOn TimeOptional

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
type RecordResponseTLSARecord struct{…}
ID string

Identifier.

maxLength32
CreatedOn Time

When the record was created.

formatdate-time
Meta RecordResponseTLSARecordMeta

Extra Cloudflare-specific metadata about the record.

DeadGlue boolOptional

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.

IsGlue boolOptional

Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.

ShadowedBy []stringOptional

IDs of the NS records that shadow this record. See Shadowed records.

ShadowedRecordsCount int64Optional

Number of records shadowed by this NS delegation. See Shadowed records.

maximum10000
minimum0
ModifiedOn Time

When the record was last modified.

formatdate-time
Proxiable bool

Whether the record can be proxied by Cloudflare or not.

CommentModifiedOn TimeOptional

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
TagsModifiedOn TimeOptional

When the record tags were last modified. Omitted if there are no tags.

formatdate-time
type RecordResponseURIRecord struct{…}
ID string

Identifier.

maxLength32
CreatedOn Time

When the record was created.

formatdate-time
Meta RecordResponseURIRecordMeta

Extra Cloudflare-specific metadata about the record.

DeadGlue boolOptional

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.

IsGlue boolOptional

Whether this A or AAAA record is glue for a subdomain NS delegation. See Glue records.

ShadowedBy []stringOptional

IDs of the NS records that shadow this record. See Shadowed records.

ShadowedRecordsCount int64Optional

Number of records shadowed by this NS delegation. See Shadowed records.

maximum10000
minimum0
ModifiedOn Time

When the record was last modified.

formatdate-time
Proxiable bool

Whether the record can be proxied by Cloudflare or not.

CommentModifiedOn TimeOptional

When the record comment was last modified. Omitted if there is no comment.

formatdate-time
TagsModifiedOn TimeOptional

When the record tags were last modified. Omitted if there are no tags.

formatdate-time

Create DNS Record

package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/cloudflare-go"
  "github.com/stainless-sdks/cloudflare-go/dns"
  "github.com/stainless-sdks/cloudflare-go/option"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  recordResponse, err := client.DNS.Records.New(context.TODO(), dns.RecordNewParams{
    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)
}
{
  "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"
  }
}