Skip to content
Start here

Configure DMARC Reports

client.EmailAuth.DMARCReports.Edit(ctx, params) (*DMARCReportEditResponse, error)
PATCH/zones/{zone_id}/email/auth/dmarc-reports

Updates the DMARC report configuration for a zone. At least one of enabled or skip_wizard must be provided. When enabling, the handler will ensure the DMARC RUA record exists in DNS.

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
ParametersExpand Collapse
params DMARCReportEditParams
ZoneID param.Field[string]

Path param: Identifier.

maxLength32
Enabled param.Field[bool]Optional

Body param: Enable or disable DMARC reports for this zone

SkipWizard param.Field[bool]Optional

Body param: Skip the DMARC setup wizard

ReturnsExpand Collapse
type DMARCReportEditResponse struct{…}

Response for GET/PATCH /dmarc-reports

ApprovedSources []DMARCReportEditResponseApprovedSourceOptional

List of approved sending sources (omitted when empty)

DeprecatedCreated TimeOptional

Deprecated, use created_at

formatdate-time
CreatedAt TimeOptional

Creation timestamp

formatdate-time
Domain stringOptional

The source domain

IPs []stringOptional

Resolved IP addresses from SPF

DeprecatedModified TimeOptional

Deprecated, use modified_at

formatdate-time
ModifiedAt TimeOptional

Last modification timestamp

formatdate-time
Name stringOptional

Source name (typically same as domain)

Slug stringOptional

URL-friendly identifier

Tag stringOptional

Source UUID

DeprecatedCreated TimeOptional

Deprecated, use created_at

formatdate-time
CreatedAt TimeOptional

Creation timestamp

formatdate-time
Enabled boolOptional

Whether DMARC reports are enabled

DeprecatedModified TimeOptional

Deprecated, use modified_at

formatdate-time
ModifiedAt TimeOptional

Last modification timestamp

formatdate-time
Records DMARCReportEditResponseRecordsOptional

Live DNS records for the zone, grouped by type

BimiRecords []DMARCReportEditResponseRecordsBimiRecordOptional

BIMI TXT records

ID stringOptional

DNS record ID

Content stringOptional

Record content

Name stringOptional

DNS record name

TTL int64Optional

Time to live in seconds

Type stringOptional

Record type

CNAMEDKIMRecords []DMARCReportEditResponseRecordsCnamedkimRecordOptional

CNAME records for DKIM

ID stringOptional

DNS record ID

Content stringOptional

Record content

Name stringOptional

DNS record name

TTL int64Optional

Time to live in seconds

Type stringOptional

Record type

CNAMEDMARCRecords []DMARCReportEditResponseRecordsCnamedmarcRecordOptional

CNAME records at _dmarc (problematic)

ID stringOptional

DNS record ID

Content stringOptional

Record content

Name stringOptional

DNS record name

TTL int64Optional

Time to live in seconds

Type stringOptional

Record type

CNAMESPFRecords []DMARCReportEditResponseRecordsCnamespfRecordOptional

CNAME records for SPF

ID stringOptional

DNS record ID

Content stringOptional

Record content

Name stringOptional

DNS record name

TTL int64Optional

Time to live in seconds

Type stringOptional

Record type

DKIMRecords []DMARCReportEditResponseRecordsDKIMRecordOptional

DKIM TXT records

ID stringOptional

DNS record ID

Content stringOptional

Record content

Name stringOptional

DNS record name

TTL int64Optional

Time to live in seconds

Type stringOptional

Record type

DMARCRecords []DMARCReportEditResponseRecordsDMARCRecordOptional

DMARC TXT records

ID stringOptional

DNS record ID

Content stringOptional

Record content

Name stringOptional

DNS record name

TTL int64Optional

Time to live in seconds

Type stringOptional

Record type

SPFRecords []DMARCReportEditResponseRecordsSPFRecordOptional

SPF TXT records

ID stringOptional

DNS record ID

Content stringOptional

Record content

Name stringOptional

DNS record name

TTL int64Optional

Time to live in seconds

Type stringOptional

Record type

RuaPrefix stringOptional

Prefix for DMARC RUA addresses (32-char hex string)

SkipWizard boolOptional

Whether to skip the setup wizard

Status DMARCReportEditResponseStatusOptional

DMARC configuration status

One of the following:
const DMARCReportEditResponseStatusMissingDMARCReport DMARCReportEditResponseStatus = "missing-dmarc-report"
const DMARCReportEditResponseStatusMultipleDMARCReports DMARCReportEditResponseStatus = "multiple-dmarc-reports"
const DMARCReportEditResponseStatusMissingDMARCRua DMARCReportEditResponseStatus = "missing-dmarc-rua"
const DMARCReportEditResponseStatusCNAMEOnDMARCRecord DMARCReportEditResponseStatus = "cname-on-dmarc-record"
DeprecatedTag stringOptional

Use zone_id instead

ZoneID stringOptional

Zone identifier

Configure DMARC Reports

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/email_auth"
  "github.com/cloudflare/cloudflare-go/option"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  response, err := client.EmailAuth.DMARCReports.Edit(context.TODO(), email_auth.DMARCReportEditParams{
    ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.ZoneID)
}
{
  "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": {
    "approved_sources": [
      {
        "created": "2024-01-15T10:30:00.12345Z",
        "created_at": "2024-01-15T10:30:00.12345Z",
        "domain": "sendgrid.net",
        "ips": [
          "192.168.1.1",
          "10.0.0.1"
        ],
        "modified": "2024-01-15T11:45:00.12345Z",
        "modified_at": "2024-01-15T11:45:00.12345Z",
        "name": "SendGrid",
        "slug": "sendgrid-net",
        "tag": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415"
      }
    ],
    "created": "2024-01-15T10:30:00.12345Z",
    "created_at": "2024-01-15T10:30:00.12345Z",
    "enabled": true,
    "modified": "2024-01-15T11:45:00.12345Z",
    "modified_at": "2024-01-15T11:45:00.12345Z",
    "records": {
      "bimi_records": [
        {
          "id": "e5bb46707a802688812d5d1c9f7977d4",
          "content": "\"v=DMARC1; p=none; rua=mailto:rua@dmarc-reports.cloudflare.net\"",
          "name": "_dmarc.example.com",
          "ttl": 300,
          "type": "TXT"
        }
      ],
      "cname_dkim_records": [
        {
          "id": "e5bb46707a802688812d5d1c9f7977d4",
          "content": "\"v=DMARC1; p=none; rua=mailto:rua@dmarc-reports.cloudflare.net\"",
          "name": "_dmarc.example.com",
          "ttl": 300,
          "type": "TXT"
        }
      ],
      "cname_dmarc_records": [
        {
          "id": "e5bb46707a802688812d5d1c9f7977d4",
          "content": "\"v=DMARC1; p=none; rua=mailto:rua@dmarc-reports.cloudflare.net\"",
          "name": "_dmarc.example.com",
          "ttl": 300,
          "type": "TXT"
        }
      ],
      "cname_spf_records": [
        {
          "id": "e5bb46707a802688812d5d1c9f7977d4",
          "content": "\"v=DMARC1; p=none; rua=mailto:rua@dmarc-reports.cloudflare.net\"",
          "name": "_dmarc.example.com",
          "ttl": 300,
          "type": "TXT"
        }
      ],
      "dkim_records": [
        {
          "id": "e5bb46707a802688812d5d1c9f7977d4",
          "content": "\"v=DMARC1; p=none; rua=mailto:rua@dmarc-reports.cloudflare.net\"",
          "name": "_dmarc.example.com",
          "ttl": 300,
          "type": "TXT"
        }
      ],
      "dmarc_records": [
        {
          "id": "e5bb46707a802688812d5d1c9f7977d4",
          "content": "\"v=DMARC1; p=none; rua=mailto:rua@dmarc-reports.cloudflare.net\"",
          "name": "_dmarc.example.com",
          "ttl": 300,
          "type": "TXT"
        }
      ],
      "spf_records": [
        {
          "id": "e5bb46707a802688812d5d1c9f7977d4",
          "content": "\"v=DMARC1; p=none; rua=mailto:rua@dmarc-reports.cloudflare.net\"",
          "name": "_dmarc.example.com",
          "ttl": 300,
          "type": "TXT"
        }
      ]
    },
    "rua_prefix": "9233c80fc89f43e3a7b749605f651868",
    "skip_wizard": false,
    "status": "missing-dmarc-report",
    "tag": "023e105f4ecef8ad9ca31a8372d0c353",
    "zone_id": "023e105f4ecef8ad9ca31a8372d0c353"
  }
}
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": {
    "approved_sources": [
      {
        "created": "2024-01-15T10:30:00.12345Z",
        "created_at": "2024-01-15T10:30:00.12345Z",
        "domain": "sendgrid.net",
        "ips": [
          "192.168.1.1",
          "10.0.0.1"
        ],
        "modified": "2024-01-15T11:45:00.12345Z",
        "modified_at": "2024-01-15T11:45:00.12345Z",
        "name": "SendGrid",
        "slug": "sendgrid-net",
        "tag": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415"
      }
    ],
    "created": "2024-01-15T10:30:00.12345Z",
    "created_at": "2024-01-15T10:30:00.12345Z",
    "enabled": true,
    "modified": "2024-01-15T11:45:00.12345Z",
    "modified_at": "2024-01-15T11:45:00.12345Z",
    "records": {
      "bimi_records": [
        {
          "id": "e5bb46707a802688812d5d1c9f7977d4",
          "content": "\"v=DMARC1; p=none; rua=mailto:rua@dmarc-reports.cloudflare.net\"",
          "name": "_dmarc.example.com",
          "ttl": 300,
          "type": "TXT"
        }
      ],
      "cname_dkim_records": [
        {
          "id": "e5bb46707a802688812d5d1c9f7977d4",
          "content": "\"v=DMARC1; p=none; rua=mailto:rua@dmarc-reports.cloudflare.net\"",
          "name": "_dmarc.example.com",
          "ttl": 300,
          "type": "TXT"
        }
      ],
      "cname_dmarc_records": [
        {
          "id": "e5bb46707a802688812d5d1c9f7977d4",
          "content": "\"v=DMARC1; p=none; rua=mailto:rua@dmarc-reports.cloudflare.net\"",
          "name": "_dmarc.example.com",
          "ttl": 300,
          "type": "TXT"
        }
      ],
      "cname_spf_records": [
        {
          "id": "e5bb46707a802688812d5d1c9f7977d4",
          "content": "\"v=DMARC1; p=none; rua=mailto:rua@dmarc-reports.cloudflare.net\"",
          "name": "_dmarc.example.com",
          "ttl": 300,
          "type": "TXT"
        }
      ],
      "dkim_records": [
        {
          "id": "e5bb46707a802688812d5d1c9f7977d4",
          "content": "\"v=DMARC1; p=none; rua=mailto:rua@dmarc-reports.cloudflare.net\"",
          "name": "_dmarc.example.com",
          "ttl": 300,
          "type": "TXT"
        }
      ],
      "dmarc_records": [
        {
          "id": "e5bb46707a802688812d5d1c9f7977d4",
          "content": "\"v=DMARC1; p=none; rua=mailto:rua@dmarc-reports.cloudflare.net\"",
          "name": "_dmarc.example.com",
          "ttl": 300,
          "type": "TXT"
        }
      ],
      "spf_records": [
        {
          "id": "e5bb46707a802688812d5d1c9f7977d4",
          "content": "\"v=DMARC1; p=none; rua=mailto:rua@dmarc-reports.cloudflare.net\"",
          "name": "_dmarc.example.com",
          "ttl": 300,
          "type": "TXT"
        }
      ]
    },
    "rua_prefix": "9233c80fc89f43e3a7b749605f651868",
    "skip_wizard": false,
    "status": "missing-dmarc-report",
    "tag": "023e105f4ecef8ad9ca31a8372d0c353",
    "zone_id": "023e105f4ecef8ad9ca31a8372d0c353"
  }
}