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
The unique identifier of the domain to update
UpdateDomainRequest
Enable or disable open tracking for emails sent from this domain
Enable or disable click tracking for emails sent from this domain
TLS configuration for the domain. See TLS Options below.
TLS Options
The TlsOption type accepts the following constants:
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
The unique identifier for the domain
Timestamp when the domain was created
The verification status of the domain
The region where emails are sent from
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)
}
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)
}