Skip to main content

Methods

Update

func (s *DomainsSvcImpl) Update(domainId string, params *UpdateDomainRequest) (Domain, error)
Updates an existing domain’s configuration.

UpdateWithContext

func (s *DomainsSvcImpl) UpdateWithContext(ctx context.Context, domainId string, params *UpdateDomainRequest) (Domain, error)
Updates an existing domain’s configuration with context support.

Parameters

domainId
string
required
The unique identifier of the domain to update

UpdateDomainRequest

open_tracking
bool
Enable or disable open tracking for emails sent from this domain
click_tracking
bool
Enable or disable click tracking for emails sent from this domain
tls
TlsOption
TLS configuration for the domain. See TLS Options below.

TLS Options

The TlsOption type accepts the following constants:
tls
string
  • resend.Enforced - Require TLS for all email delivery
  • resend.Opportunistic - Use TLS when available, fall back to unencrypted if not
const (
    Enforced      TlsOption = "enforced"
    Opportunistic TlsOption = "opportunistic"
)

Response

Domain

id
string
The unique identifier for the domain
object
string
Object type (“domain”)
name
string
The domain name
created_at
string
Timestamp when the domain was created
status
string
The verification status of the domain
region
string
The region where emails are sent from
records
[]Record
DNS records for domain verification

Examples

Enable Tracking

package main

import (
    "fmt"
    "github.com/resend/resend-go/v2"
)

func main() {
    client := resend.NewClient("re_123456789")

    params := &resend.UpdateDomainRequest{
        OpenTracking:  true,
        ClickTracking: true,
    }

    domain, err := client.Domains.Update("d1e9e6f7-6a1c-4b3d-8c9e-1f2e3d4c5b6a", params)
    if err != nil {
        panic(err)
    }

    fmt.Println("Domain updated:", domain.Name)
}

Configure TLS

params := &resend.UpdateDomainRequest{
    Tls: resend.Enforced,
}

domain, err := client.Domains.Update("d1e9e6f7-6a1c-4b3d-8c9e-1f2e3d4c5b6a", params)
if err != nil {
    panic(err)
}

Update Multiple Settings

ctx := context.Background()

params := &resend.UpdateDomainRequest{
    OpenTracking:  true,
    ClickTracking: false,
    Tls:           resend.Opportunistic,
}

domain, err := client.Domains.UpdateWithContext(ctx, "d1e9e6f7-6a1c-4b3d-8c9e-1f2e3d4c5b6a", params)
if err != nil {
    panic(err)
}

Build docs developers (and LLMs) love