Skip to main content

Methods

Verify

func (s *DomainsSvcImpl) Verify(domainId string) (bool, error)
Verifies DNS records for a domain.

VerifyWithContext

func (s *DomainsSvcImpl) VerifyWithContext(ctx context.Context, domainId string) (bool, error)
Verifies DNS records for a domain with context support.

Parameters

domainId
string
required
The unique identifier of the domain to verify

Response

verified
bool
Returns true if the verification request was successful. Note: This indicates the verification was initiated, not that the domain is verified. Check the domain status using Get Domain to confirm verification.

Example

package main

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

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

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

    if verified {
        fmt.Println("Verification initiated successfully")
        
        // Check the actual status
        domain, err := client.Domains.Get("d1e9e6f7-6a1c-4b3d-8c9e-1f2e3d4c5b6a")
        if err != nil {
            panic(err)
        }
        
        fmt.Println("Domain status:", domain.Status)
    }
}

Example with Context

ctx := context.Background()

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

Notes

Before calling this method, ensure you have:
  1. Added all required DNS records to your domain’s DNS configuration
  2. Waited for DNS propagation (can take up to 48 hours, but usually much faster)
After verification, the domain’s status will update from “pending” to “verified” if all DNS records are correctly configured.

Build docs developers (and LLMs) love