Skip to main content

Methods

List

func (s *DomainsSvcImpl) List() (ListDomainsResponse, error)
Retrieves a list of all domains.

ListWithContext

func (s *DomainsSvcImpl) ListWithContext(ctx context.Context) (ListDomainsResponse, error)
Retrieves a list of all domains with context support.

ListWithOptions

func (s *DomainsSvcImpl) ListWithOptions(ctx context.Context, options *ListOptions) (ListDomainsResponse, error)
Retrieves a list of domains with pagination options.

Parameters

ListOptions (for ListWithOptions)

limit
*int
Maximum number of domains to return per page
after
*string
Cursor for pagination - retrieve results after this cursor
before
*string
Cursor for pagination - retrieve results before this cursor

Response

ListDomainsResponse

object
string
Object type (“list”)
data
[]Domain
Array of domain objects. Each domain contains:
  • id (string): Domain identifier
  • object (string): Object type
  • name (string): Domain name
  • created_at (string): Creation timestamp
  • status (string): Verification status
  • region (string): Email sending region
  • records ([]Record): DNS records
has_more
bool
Whether there are more results available for pagination

Examples

Basic Usage

package main

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

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

    domains, err := client.Domains.List()
    if err != nil {
        panic(err)
    }

    fmt.Println("Total domains:", len(domains.Data))
    for _, domain := range domains.Data {
        fmt.Printf("- %s (%s)\n", domain.Name, domain.Status)
    }
}

With Pagination

ctx := context.Background()

limit := 10
options := &resend.ListOptions{
    Limit: &limit,
}

domains, err := client.Domains.ListWithOptions(ctx, options)
if err != nil {
    panic(err)
}

fmt.Println("Domains:", len(domains.Data))
fmt.Println("Has more:", domains.HasMore)

With Context

ctx := context.Background()

domains, err := client.Domains.ListWithContext(ctx)
if err != nil {
    panic(err)
}

Build docs developers (and LLMs) love