Skip to main content
Get the Resend Go SDK installed and configured in your Go application.

Requirements

Before installing the SDK, ensure your environment meets these requirements:
  • Go 1.23 or later - The SDK requires Go 1.23+
  • Go modules - The SDK uses Go modules for dependency management

Install the SDK

1

Install via go get

Add the Resend Go SDK to your project using the go get command:
go get github.com/resend/resend-go/v3
This downloads the SDK and adds it to your go.mod file.
2

Import the package

Import the Resend package in your Go files:
import "github.com/resend/resend-go/v3"
Make sure to use the /v3 suffix in the import path to get the latest version of the SDK.
3

Verify installation

Create a simple file to verify the installation:
package main

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

func main() {
    client := resend.NewClient("your_api_key")
    fmt.Println("Resend client initialized successfully")
}
Run the file to confirm everything is working:
go run main.go
You should see the success message printed to the console.

Package structure

The Resend Go SDK is organized into service-based modules:
package main

import "github.com/resend/resend-go/v3"

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

    // Access different services through the client
    client.Emails       // Send and manage emails
    client.Batch        // Send batch emails
    client.Domains      // Manage domains
    client.ApiKeys      // Manage API keys
    client.Contacts     // Manage contacts
    client.Segments     // Manage segments (audiences)
    client.Broadcasts   // Send broadcasts
    client.Templates    // Manage email templates
    client.Topics       // Manage topics
    client.Webhooks     // Manage webhooks
}

Dependencies

The SDK has minimal dependencies. The only testing dependency is:
  • github.com/stretchr/testify - Used for testing (not required in production)
All other dependencies are part of the Go standard library.

Custom HTTP client

By default, the SDK uses a standard HTTP client with a 1-minute timeout. You can provide your own HTTP client for custom configurations:
package main

import (
    "net/http"
    "time"
    "github.com/resend/resend-go/v3"
)

func main() {
    // Create custom HTTP client
    httpClient := &http.Client{
        Timeout: 30 * time.Second,
    }

    // Initialize Resend with custom client
    client := resend.NewCustomClient(httpClient, "re_123")
}
This is useful when you need to:
  • Configure custom timeouts
  • Add retry logic
  • Use custom transport layers
  • Implement request/response logging

Environment configuration

The SDK reads the RESEND_BASE_URL environment variable if you need to use a custom API endpoint. This is typically only needed for testing or enterprise configurations.

Next steps

Now that you have the SDK installed, you’re ready to send your first email:

Quickstart

Learn how to send your first email with the Resend Go SDK

Build docs developers (and LLMs) love