Help us shape the future of Go! Take the 2026 Go Developer Survey

smtpfast

package module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 19 Imported by: 0

README

SMTPfast Go SDK

The official Go SDK for the SMTPfast API. It covers every endpoint in the API, with a struct for every request and response, and uses only the standard library. It needs Go 1.24+.

go get github.com/smtpfast/smtpfast-go

Send an email

client := smtpfast.NewClient() // reads SMTPFAST_API_KEY

email, err := client.Emails.Send(ctx, &smtpfast.SendEmailRequest{
	From:     smtpfast.String("Acme <hello@yourdomain.com>"),
	To:       smtpfast.StringList{"customer@example.org"},
	Subject:  smtpfast.String("Your receipt"),
	HTML:     smtpfast.String("<p>Thanks for your order.</p>"),
	Category: smtpfast.String("transactional"),
})
if err != nil {
	return err
}
fmt.Println(email.ID)

Email is marketing unless you set category to transactional. Marketing email gets a one-click unsubscribe header and is not sent to people who unsubscribed. Set transactional on receipts, password resets and account alerts so a marketing opt-out does not block them.

Every API operation is a method, named after its path: client.Domains.Verify(ctx, id), client.Contacts.Segments.Add(ctx, contactID, segmentID), client.Inboxes.Threads.Emails.Reply(ctx, inboxID, threadID, emailID, params). Path parameters come first, then the request body, then the query struct, then options. Optional fields are pointers; smtpfast.String, smtpfast.Int and smtpfast.Bool make them. A field that is optional and can be null is a smtpfast.Nullable[T]: leave it out, set smtpfast.Value(x), or send smtpfast.Null[T]() to clear it. An empty list that you set is sent, so it clears the list.

Options

client := smtpfast.NewClient(
	smtpfast.WithAPIKey("sf_..."),
	smtpfast.WithMaxRetries(2),            // after 429 (with Retry-After), 408, 5xx and dropped connections
	smtpfast.WithTimeout(60*time.Second),  // per attempt
)

client.Emails.Send(ctx, params, smtpfast.WithIdempotencyKey("order-1234"), smtpfast.WithRequestTimeout(10*time.Second))

Reads, PUT and DELETE are retried after a 5xx answer or a dropped connection. A send, reply or forward is retried with the same Idempotency-Key, which the SDK makes when you do not give one, so the API returns the first answer instead of sending twice. Other POST and PATCH calls are retried only after a per-second rate limit.

Errors

An answer outside 2xx is an *smtpfast.APIError with StatusCode, Message and the raw Body. No answer is a *smtpfast.ConnectionError. smtpfast.IsNotFound(err), IsUnauthorized, IsForbidden and IsRateLimited check the common cases.

Pagination

Lists that page with a cursor also have an ...All method that returns an iterator:

for email, err := range client.Emails.ListAll(ctx, &smtpfast.ListEmailsQuery{Limit: smtpfast.Int(100)}) {
	if err != nil {
		return err
	}
	fmt.Println(email.ID, email.Status)
}

Webhooks

body, _ := io.ReadAll(r.Body) // the raw body, before any JSON parsing
if !smtpfast.VerifyWebhookSignature(body, r.Header.Get("X-SMTPfast-Signature"), secret) {
	http.Error(w, "bad signature", http.StatusUnauthorized)
	return
}

How this SDK is made

scripts/generate.py (Python 3 standard library) writes types_gen.go and resources_gen.go from spec/openapi.json, naming every method from the x-sdk-group and x-sdk-method the spec gives each operation; the SDKs for other languages use the same names. client.go, core.go, errors.go and webhooks.go are written by hand.

python3 scripts/pull_spec.py   # download the published spec
python3 scripts/generate.py    # regenerate types_gen.go and resources_gen.go
go test ./...                  # unit tests, including one call per operation
SMTPFAST_API_KEY=sf_... go test -run TestLive -v ./...   # read-only calls; every answer must decode

License

MIT

Documentation

Overview

Package smtpfast is the official Go SDK for the SMTPfast API.

client := smtpfast.NewClient() // reads SMTPFAST_API_KEY
email, err := client.Emails.Send(ctx, &smtpfast.SendEmailRequest{
	From: smtpfast.String("you@yourdomain.com"), To: smtpfast.StringList{"them@example.org"},
	Subject: smtpfast.String("Hi"), Text: smtpfast.String("Hello"),
})

Index

Constants

View Source
const Version = "0.1.1"

Version is the SDK version, sent in the User-Agent header.

Variables

This section is empty.

Functions

func Bool

func Bool(b bool) *bool

Bool returns a pointer to b, for optional fields.

func Int

func Int(n int64) *int64

Int returns a pointer to n, for optional fields.

func IsForbidden

func IsForbidden(err error) bool

IsForbidden reports whether err is a 403: the key lacks the scope, or the domain is not verified.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound reports whether err is a 404 from the API.

func IsRateLimited

func IsRateLimited(err error) bool

IsRateLimited reports whether err is a 429.

func IsUnauthorized

func IsUnauthorized(err error) bool

IsUnauthorized reports whether err is a 401: a missing or wrong API key.

func String

func String(s string) *string

String returns a pointer to s, for optional fields.

func VerifyWebhookSignature

func VerifyWebhookSignature(payload []byte, signature, secret string) bool

VerifyWebhookSignature checks that a webhook request came from SMTPfast. signature is the X-SMTPfast-Signature header: the hex HMAC-SHA256 of the raw request body, keyed with the webhook's signing secret. Pass the body exactly as received, before any JSON parsing.

Types

type APIError

type APIError struct {
	StatusCode int
	// Message is the API's "error" field, or the raw body when it is not JSON.
	Message string
	// Body is the raw response body; it can hold more fields, such as missing_variables.
	Body   []byte
	Header http.Header
}

APIError is an answer outside 2xx. Check the status with errors.As, or with IsNotFound, IsRateLimited and the other helpers.

func (*APIError) Error

func (e *APIError) Error() string

type APIKey

type APIKey struct {
	ID         string           `json:"id"`
	Name       string           `json:"name"`
	Prefix     string           `json:"prefix"`
	Scopes     []string         `json:"scopes"`
	CreatedAt  string           `json:"created_at"`
	LastUsedAt Nullable[string] `json:"last_used_at,omitzero"`
	RevokedAt  Nullable[string] `json:"revoked_at,omitzero"`
	// ExpiresAt: Set for connected-app keys, which rotate.
	ExpiresAt Nullable[string] `json:"expires_at,omitzero"`
	// GrantExpiresAt: When a connected app's grant ends.
	GrantExpiresAt Nullable[string] `json:"grant_expires_at,omitzero"`
}

APIKey: List and update responses also carry the same values in camelCase (keyPrefix, createdAt, lastUsedAt, revokedAt, expiresAt, grantExpiresAt) for older c

type APIKeyCreated

type APIKeyCreated struct {
	ID        *string  `json:"id,omitzero"`
	Name      *string  `json:"name,omitzero"`
	Key       *string  `json:"key,omitzero"`
	Prefix    *string  `json:"prefix,omitzero"`
	Scopes    []string `json:"scopes,omitzero"`
	CreatedAt *string  `json:"created_at,omitzero"`
}

APIKeyCreated: Returned when a new API key is created. The key field contains the full secret and is only shown once.

type APIKeysService

type APIKeysService struct {
	// contains filtered or unexported fields
}

APIKeysService groups the apiKeys operations.

func (*APIKeysService) Create

func (s *APIKeysService) Create(ctx context.Context, params *CreateAPIKeyRequest, opts ...RequestOption) (*APIKeyCreated, error)

Create: Create API key (POST /v1/api-keys).

func (*APIKeysService) List

List: List API keys (GET /v1/api-keys).

func (*APIKeysService) Revoke

Revoke: Revoke API key (DELETE /v1/api-keys/{id}).

func (*APIKeysService) Update

Update: Update API key (PATCH /v1/api-keys/{id}).

type AccountService

type AccountService struct {
	// contains filtered or unexported fields
}

AccountService groups the account operations.

func (*AccountService) Me

Me: What this API key can do (GET /v1/me).

func (*AccountService) Usage

func (s *AccountService) Usage(ctx context.Context, opts ...RequestOption) (*Usage, error)

Usage: Usage against the plan (GET /v1/usage).

type AddDomainRequest

type AddDomainRequest struct {
	// Domain: The domain name to register for sending
	Domain string `json:"domain"`
}

type AddSuppressionsBatchParams

type AddSuppressionsBatchParams struct {
	Emails []string `json:"emails"`
}

type Analytics

type Analytics struct {
	// Total: Every email on the account, whatever its status
	Total *int64 `json:"total,omitzero"`
	// Sent: Emails that went out (sent, delivered, opened, clicked, bounced or complained). The rates are worked out against this.
	Sent *int64 `json:"sent,omitzero"`
	// Today: Emails sent in the last 24 hours
	Today *int64 `json:"today,omitzero"`
	// ThisWeek: Emails sent in the last 7 days
	ThisWeek *int64 `json:"thisWeek,omitzero"`
	// Delivered: Accepted by the receiving server, including those later opened or clicked
	Delivered  *int64 `json:"delivered,omitzero"`
	Bounced    *int64 `json:"bounced,omitzero"`
	Complained *int64 `json:"complained,omitzero"`
	// Failed: Never sent because of an error
	Failed *int64 `json:"failed,omitzero"`
	// Pending: Scheduled, queued or sending; not counted in any rate yet
	Pending  *int64 `json:"pending,omitzero"`
	Canceled *int64 `json:"canceled,omitzero"`
	// AwaitingReport: Sent, with no delivery or bounce report yet; not counted in the rates
	AwaitingReport *int64 `json:"awaitingReport,omitzero"`
	// DeliveryRate: (delivered + complained) / (sent - awaitingReport), as a percentage
	DeliveryRate *float64 `json:"deliveryRate,omitzero"`
	// BounceRate: bounced / (sent - awaitingReport), as a percentage
	BounceRate *float64 `json:"bounceRate,omitzero"`
	// Daily: Last 30 days, bucketed by the UTC day each email was sent
	Daily []AnalyticsDailyItem `json:"daily,omitzero"`
	Usage *AnalyticsUsage      `json:"usage,omitzero"`
	// Window: Present when days or domain is passed
	Window *AnalyticsWindow `json:"window,omitzero"`
}

type AnalyticsDailyItem

type AnalyticsDailyItem struct {
	Date      *string `json:"date,omitzero"`
	Sent      *int64  `json:"sent,omitzero"`
	Delivered *int64  `json:"delivered,omitzero"`
	Bounced   *int64  `json:"bounced,omitzero"`
}

type AnalyticsService

type AnalyticsService struct {
	// contains filtered or unexported fields
}

AnalyticsService groups the analytics operations.

func (*AnalyticsService) Get

Get: Get analytics (GET /v1/analytics).

type AnalyticsUsage

type AnalyticsUsage struct {
	Period    *string `json:"period,omitzero"`
	Sent      *int64  `json:"sent,omitzero"`
	Delivered *int64  `json:"delivered,omitzero"`
	Bounced   *int64  `json:"bounced,omitzero"`
	Limit     *int64  `json:"limit,omitzero"`
	Tier      *string `json:"tier,omitzero"`
}

type AnalyticsWindow

type AnalyticsWindow struct {
	Days         *int64                       `json:"days,omitzero"`
	From         *string                      `json:"from,omitzero"`
	To           *string                      `json:"to,omitzero"`
	Domain       Nullable[string]             `json:"domain,omitzero"`
	Counts       *AnalyticsWindowCounts       `json:"counts,omitzero"`
	RatesPercent *AnalyticsWindowRatesPercent `json:"rates_percent,omitzero"`
	Complete     *bool                        `json:"complete,omitzero"`
}

AnalyticsWindow: Present when days or domain is passed

type AnalyticsWindowCounts

type AnalyticsWindowCounts struct {
	Sent        *int64 `json:"sent,omitzero"`
	Delivered   *int64 `json:"delivered,omitzero"`
	HardBounced *int64 `json:"hard_bounced,omitzero"`
	SoftBounced *int64 `json:"soft_bounced,omitzero"`
	Complained  *int64 `json:"complained,omitzero"`
	Failed      *int64 `json:"failed,omitzero"`
}

type AnalyticsWindowRatesPercent

type AnalyticsWindowRatesPercent struct {
	Delivered   *float64 `json:"delivered,omitzero"`
	HardBounced *float64 `json:"hard_bounced,omitzero"`
	SoftBounced *float64 `json:"soft_bounced,omitzero"`
	Complained  *float64 `json:"complained,omitzero"`
}

type ApproveAllPendingSignupsParams

type ApproveAllPendingSignupsParams struct {
	// Q: Only approve signups matching this search
	Q *string `json:"q,omitzero"`
}

type ApproveAllPendingSignupsResponse

type ApproveAllPendingSignupsResponse struct {
	Approved             int64 `json:"approved"`
	Skipped              int64 `json:"skipped"`
	Remaining            int64 `json:"remaining"`
	SkippedUndeliverable int64 `json:"skipped_undeliverable"`
	SkippedTor           int64 `json:"skipped_tor"`
}

type ApprovePendingSignupResponse

type ApprovePendingSignupResponse struct {
	Approved         bool    `json:"approved"`
	ContactID        *string `json:"contact_id,omitzero"`
	Email            string  `json:"email"`
	AlreadyConfirmed *bool   `json:"already_confirmed,omitzero"`
}

type BatchSendResponse

type BatchSendResponse struct {
	// BatchID: Identifier for the batch as a whole
	BatchID string `json:"batch_id"`
	// Count: Number of emails created (matches input length)
	Count int64 `json:"count"`
	// Emails: Per-row result. status is "queued" for normal sends, "scheduled" if scheduled_at is in the future, or "failed" if the row has no deliverable To recipi
	Emails []BatchSendResponseEmailsItem `json:"emails"`
	// Data: The same ids in Resend's batch response shape: one { id } per item, in request order.
	Data []BatchSendResponseDataItem `json:"data"`
}

type BatchSendResponseDataItem

type BatchSendResponseDataItem struct {
	ID string `json:"id"`
}

type BatchSendResponseEmailsItem

type BatchSendResponseEmailsItem struct {
	ID     string `json:"id"`
	Status string `json:"status"`
}

type Broadcast

type Broadcast struct {
	Object   *string `json:"object,omitzero"`
	ID       string  `json:"id"`
	Name     string  `json:"name"`
	Audience *string `json:"audience,omitzero"`
	// AudienceMeta: Details of the audience, such as the segment_id
	AudienceMeta map[string]any `json:"audience_meta,omitzero"`
	// SegmentID: The segment the broadcast goes to when audience is segment, otherwise null
	SegmentID   Nullable[string] `json:"segment_id,omitzero"`
	From        Nullable[string] `json:"from,omitzero"`
	ReplyTo     Nullable[string] `json:"reply_to,omitzero"`
	Subject     Nullable[string] `json:"subject,omitzero"`
	PreviewText Nullable[string] `json:"preview_text,omitzero"`
	HTML        Nullable[string] `json:"html,omitzero"`
	Text        Nullable[string] `json:"text,omitzero"`
	Markdown    Nullable[string] `json:"markdown,omitzero"`
	Status      string           `json:"status"`
	ScheduledAt Nullable[string] `json:"scheduled_at,omitzero"`
	QueuedAt    Nullable[string] `json:"queued_at,omitzero"`
	SentAt      Nullable[string] `json:"sent_at,omitzero"`
	CanceledAt  Nullable[string] `json:"canceled_at,omitzero"`
	// ArchivedAt: When the broadcast was archived. Archived broadcasts are left out of the list unless archived=true or archived=all.
	ArchivedAt Nullable[string] `json:"archived_at,omitzero"`
	// PausedAt: Set when the campaign was stopped mid-send by the deliverability guard
	PausedAt Nullable[string] `json:"paused_at,omitzero"`
	// PauseReason: Why the campaign was paused, for example the complaint rate that tripped the guard
	PauseReason Nullable[string] `json:"pause_reason,omitzero"`
	// FanoutCompletedAt: When every recipient of the send had been created
	FanoutCompletedAt Nullable[string] `json:"fanout_completed_at,omitzero"`
	// ExpectedRecipients: Eligible recipients counted when the send was accepted
	ExpectedRecipients Nullable[int64] `json:"expected_recipients,omitzero"`
	// SendOverMinutes: Minutes the send is spread over from its start (scheduled_at, else queued_at); 0 means all at once
	SendOverMinutes *int64            `json:"send_over_minutes,omitzero"`
	TrackOpens      *bool             `json:"track_opens,omitzero"`
	TrackClicks     *bool             `json:"track_clicks,omitzero"`
	RecipientCount  *int64            `json:"recipient_count,omitzero"`
	Metrics         *BroadcastMetrics `json:"metrics,omitzero"`
	CreatedAt       string            `json:"created_at"`
	UpdatedAt       string            `json:"updated_at"`
}

type BroadcastDetail

type BroadcastDetail struct {
	Object   *string `json:"object,omitzero"`
	ID       string  `json:"id"`
	Name     string  `json:"name"`
	Audience *string `json:"audience,omitzero"`
	// AudienceMeta: Details of the audience, such as the segment_id
	AudienceMeta map[string]any `json:"audience_meta,omitzero"`
	// SegmentID: The segment the broadcast goes to when audience is segment, otherwise null
	SegmentID   Nullable[string] `json:"segment_id,omitzero"`
	From        Nullable[string] `json:"from,omitzero"`
	ReplyTo     Nullable[string] `json:"reply_to,omitzero"`
	Subject     Nullable[string] `json:"subject,omitzero"`
	PreviewText Nullable[string] `json:"preview_text,omitzero"`
	HTML        Nullable[string] `json:"html,omitzero"`
	Text        Nullable[string] `json:"text,omitzero"`
	Markdown    Nullable[string] `json:"markdown,omitzero"`
	Status      string           `json:"status"`
	ScheduledAt Nullable[string] `json:"scheduled_at,omitzero"`
	QueuedAt    Nullable[string] `json:"queued_at,omitzero"`
	SentAt      Nullable[string] `json:"sent_at,omitzero"`
	CanceledAt  Nullable[string] `json:"canceled_at,omitzero"`
	// ArchivedAt: When the broadcast was archived. Archived broadcasts are left out of the list unless archived=true or archived=all.
	ArchivedAt Nullable[string] `json:"archived_at,omitzero"`
	// PausedAt: Set when the campaign was stopped mid-send by the deliverability guard
	PausedAt Nullable[string] `json:"paused_at,omitzero"`
	// PauseReason: Why the campaign was paused, for example the complaint rate that tripped the guard
	PauseReason Nullable[string] `json:"pause_reason,omitzero"`
	// FanoutCompletedAt: When every recipient of the send had been created
	FanoutCompletedAt Nullable[string] `json:"fanout_completed_at,omitzero"`
	// ExpectedRecipients: Eligible recipients counted when the send was accepted
	ExpectedRecipients Nullable[int64] `json:"expected_recipients,omitzero"`
	// SendOverMinutes: Minutes the send is spread over from its start (scheduled_at, else queued_at); 0 means all at once
	SendOverMinutes *int64                     `json:"send_over_minutes,omitzero"`
	TrackOpens      *bool                      `json:"track_opens,omitzero"`
	TrackClicks     *bool                      `json:"track_clicks,omitzero"`
	RecipientCount  *int64                     `json:"recipient_count,omitzero"`
	Metrics         *BroadcastMetrics          `json:"metrics,omitzero"`
	CreatedAt       string                     `json:"created_at"`
	UpdatedAt       string                     `json:"updated_at"`
	Recipients      []BroadcastRecipientDetail `json:"recipients"`
	Links           []BroadcastDetailLinksItem `json:"links"`
}

BroadcastDetail: A broadcast with its latest 250 recipients and the links clicked in it.

type BroadcastDetailLinksItem

type BroadcastDetailLinksItem struct {
	URL    string `json:"url"`
	Clicks int64  `json:"clicks"`
}

type BroadcastList

type BroadcastList struct {
	Object   string      `json:"object"`
	Data     []Broadcast `json:"data"`
	HasMore  bool        `json:"has_more"`
	Page     *int64      `json:"page,omitzero"`
	PageSize *int64      `json:"page_size,omitzero"`
	// FilteredTotal: Broadcasts matching the status, search and archived filters
	FilteredTotal *int64 `json:"filtered_total,omitzero"`
	// Total: Every broadcast of the team that is not archived
	Total *int64 `json:"total,omitzero"`
	// ArchivedTotal: Archived broadcasts of the team
	ArchivedTotal *int64 `json:"archived_total,omitzero"`
	// StatusCounts: Broadcasts that are not archived, per status
	StatusCounts map[string]int64 `json:"status_counts,omitzero"`
}

type BroadcastMetrics

type BroadcastMetrics struct {
	Total   *int64 `json:"total,omitzero"`
	Skipped *int64 `json:"skipped,omitzero"`
	Queued  *int64 `json:"queued,omitzero"`
	Sending *int64 `json:"sending,omitzero"`
	// HandedOff: Recipients whose email the provider accepted, whatever happened next. Shows how far a send spread over send_over_minutes has got.
	HandedOff       *int64   `json:"handed_off,omitzero"`
	Sent            *int64   `json:"sent,omitzero"`
	Delivered       *int64   `json:"delivered,omitzero"`
	Opened          *int64   `json:"opened,omitzero"`
	Clicked         *int64   `json:"clicked,omitzero"`
	Unsubscribed    *int64   `json:"unsubscribed,omitzero"`
	Bounced         *int64   `json:"bounced,omitzero"`
	Complained      *int64   `json:"complained,omitzero"`
	Failed          *int64   `json:"failed,omitzero"`
	Canceled        *int64   `json:"canceled,omitzero"`
	DeliveryRate    *float64 `json:"delivery_rate,omitzero"`
	OpenRate        *float64 `json:"open_rate,omitzero"`
	ClickRate       *float64 `json:"click_rate,omitzero"`
	UnsubscribeRate *float64 `json:"unsubscribe_rate,omitzero"`
	BounceRate      *float64 `json:"bounce_rate,omitzero"`
}

type BroadcastRecipientDetail

type BroadcastRecipientDetail struct {
	ID        string           `json:"id"`
	Email     string           `json:"email"`
	FirstName Nullable[string] `json:"first_name,omitzero"`
	LastName  Nullable[string] `json:"last_name,omitzero"`
	Status    string           `json:"status"`
	// SkipReason: Why the contact was left out: unsubscribed, suppressed or invalid
	SkipReason     Nullable[string]                     `json:"skip_reason,omitzero"`
	EmailID        Nullable[string]                     `json:"email_id,omitzero"`
	QueuedAt       Nullable[string]                     `json:"queued_at,omitzero"`
	SentAt         Nullable[string]                     `json:"sent_at,omitzero"`
	DeliveredAt    Nullable[string]                     `json:"delivered_at,omitzero"`
	OpenedAt       Nullable[string]                     `json:"opened_at,omitzero"`
	ClickedAt      Nullable[string]                     `json:"clicked_at,omitzero"`
	BouncedAt      Nullable[string]                     `json:"bounced_at,omitzero"`
	ComplainedAt   Nullable[string]                     `json:"complained_at,omitzero"`
	UnsubscribedAt Nullable[string]                     `json:"unsubscribed_at,omitzero"`
	FailedAt       Nullable[string]                     `json:"failed_at,omitzero"`
	ErrorMessage   Nullable[string]                     `json:"error_message,omitzero"`
	Events         []BroadcastRecipientDetailEventsItem `json:"events"`
}

type BroadcastRecipientDetailEventsItem

type BroadcastRecipientDetailEventsItem struct {
	ID        string         `json:"id"`
	Type      string         `json:"type"`
	Metadata  map[string]any `json:"metadata,omitzero"`
	CreatedAt string         `json:"created_at"`
}

type BroadcastSendResult

type BroadcastSendResult struct {
	Object   string  `json:"object"`
	ID       string  `json:"id"`
	Name     string  `json:"name"`
	Audience *string `json:"audience,omitzero"`
	// AudienceMeta: Details of the audience, such as the segment_id
	AudienceMeta map[string]any `json:"audience_meta,omitzero"`
	// SegmentID: The segment the broadcast goes to when audience is segment, otherwise null
	SegmentID   Nullable[string] `json:"segment_id,omitzero"`
	From        Nullable[string] `json:"from,omitzero"`
	ReplyTo     Nullable[string] `json:"reply_to,omitzero"`
	Subject     Nullable[string] `json:"subject,omitzero"`
	PreviewText Nullable[string] `json:"preview_text,omitzero"`
	HTML        Nullable[string] `json:"html,omitzero"`
	Text        Nullable[string] `json:"text,omitzero"`
	Markdown    Nullable[string] `json:"markdown,omitzero"`
	Status      string           `json:"status"`
	ScheduledAt Nullable[string] `json:"scheduled_at,omitzero"`
	QueuedAt    Nullable[string] `json:"queued_at,omitzero"`
	SentAt      Nullable[string] `json:"sent_at,omitzero"`
	CanceledAt  Nullable[string] `json:"canceled_at,omitzero"`
	// ArchivedAt: When the broadcast was archived. Archived broadcasts are left out of the list unless archived=true or archived=all.
	ArchivedAt Nullable[string] `json:"archived_at,omitzero"`
	// PausedAt: Set when the campaign was stopped mid-send by the deliverability guard
	PausedAt Nullable[string] `json:"paused_at,omitzero"`
	// PauseReason: Why the campaign was paused, for example the complaint rate that tripped the guard
	PauseReason Nullable[string] `json:"pause_reason,omitzero"`
	// FanoutCompletedAt: When every recipient of the send had been created
	FanoutCompletedAt Nullable[string] `json:"fanout_completed_at,omitzero"`
	// ExpectedRecipients: Eligible recipients counted when the send was accepted
	ExpectedRecipients Nullable[int64] `json:"expected_recipients,omitzero"`
	// SendOverMinutes: Minutes the send is spread over from its start (scheduled_at, else queued_at); 0 means all at once
	SendOverMinutes *int64            `json:"send_over_minutes,omitzero"`
	TrackOpens      *bool             `json:"track_opens,omitzero"`
	TrackClicks     *bool             `json:"track_clicks,omitzero"`
	RecipientCount  *int64            `json:"recipient_count,omitzero"`
	Metrics         *BroadcastMetrics `json:"metrics,omitzero"`
	CreatedAt       string            `json:"created_at"`
	UpdatedAt       string            `json:"updated_at"`
	// Recipients: Contacts the send will reach
	Recipients int64 `json:"recipients"`
	// Skipped: Contacts left out: unsubscribed, suppressed or invalid
	Skipped int64  `json:"skipped"`
	BatchID string `json:"batch_id"`
}

type BroadcastsRecipientsService

type BroadcastsRecipientsService struct {
	// contains filtered or unexported fields
}

BroadcastsRecipientsService groups the broadcasts.recipients operations.

func (*BroadcastsRecipientsService) List

List: List broadcast recipients (GET /v1/broadcasts/{id}/recipients).

type BroadcastsService

type BroadcastsService struct {
	Recipients *BroadcastsRecipientsService
	// contains filtered or unexported fields
}

BroadcastsService groups the broadcasts operations.

func (*BroadcastsService) Archive

func (s *BroadcastsService) Archive(ctx context.Context, id string, opts ...RequestOption) (*Broadcast, error)

Archive: Archive a broadcast (POST /v1/broadcasts/{id}/archive).

func (*BroadcastsService) Cancel

func (s *BroadcastsService) Cancel(ctx context.Context, id string, opts ...RequestOption) (*Broadcast, error)

Cancel: Cancel a scheduled broadcast (POST /v1/broadcasts/{id}/cancel).

func (*BroadcastsService) Create

Create: Create a broadcast draft (POST /v1/broadcasts).

func (*BroadcastsService) Delete

func (s *BroadcastsService) Delete(ctx context.Context, id string, opts ...RequestOption) (*DeletedObject, error)

Delete: Delete a draft broadcast (DELETE /v1/broadcasts/{id}).

func (*BroadcastsService) Duplicate

Duplicate: Duplicate broadcast (POST /v1/broadcasts/{id}/duplicate).

func (*BroadcastsService) Get

Get: Get broadcast details (GET /v1/broadcasts/{id}).

func (*BroadcastsService) GetAudience

func (s *BroadcastsService) GetAudience(ctx context.Context, query *GetBroadcastAudienceQuery, opts ...RequestOption) (map[string]any, error)

GetAudience: Preview a broadcast audience (GET /v1/broadcasts/audience).

func (*BroadcastsService) List

List: List broadcasts (GET /v1/broadcasts).

ListClickedLinks: List clicked links (GET /v1/broadcasts/{id}/clicked-links).

func (*BroadcastsService) Send

Send: Send or schedule a broadcast (POST /v1/broadcasts/{id}/send).

func (*BroadcastsService) SendTest

SendTest: Send a test broadcast email (POST /v1/broadcasts/{id}/test).

func (*BroadcastsService) Unarchive

func (s *BroadcastsService) Unarchive(ctx context.Context, id string, opts ...RequestOption) (*Broadcast, error)

Unarchive: Unarchive a broadcast (POST /v1/broadcasts/{id}/unarchive).

func (*BroadcastsService) Update

Update: Update a draft or scheduled broadcast (PATCH /v1/broadcasts/{id}).

type CancelEmailResponse

type CancelEmailResponse struct {
	Object string `json:"object"`
	ID     string `json:"id"`
}

type ClaimDomainParams

type ClaimDomainParams struct {
	Domain string `json:"domain"`
}

type ClaimDomainResponse

type ClaimDomainResponse struct {
	ID        *string `json:"id,omitzero"`
	Domain    *string `json:"domain,omitzero"`
	Status    *string `json:"status,omitzero"`
	CreatedAt *string `json:"created_at,omitzero"`
	Message   *string `json:"message,omitzero"`
}

type Client

type Client struct {
	*Service
}

Client is the SMTPfast API client. Every operation is a method on one of its services, named after the path: client.Emails.Send, client.Inboxes.Threads.Emails.Reply.

func NewClient

func NewClient(opts ...Option) *Client

NewClient makes a client. Without WithAPIKey it reads SMTPFAST_API_KEY; a request without a key fails with an error that says so.

type ConnectionError

type ConnectionError struct {
	Err     error
	Timeout bool
}

ConnectionError means no answer arrived: DNS, TLS, a reset connection, or a timeout.

func (*ConnectionError) Error

func (e *ConnectionError) Error() string

func (*ConnectionError) Unwrap

func (e *ConnectionError) Unwrap() error

type Contact

type Contact struct {
	ID           string           `json:"id"`
	Email        string           `json:"email"`
	FirstName    Nullable[string] `json:"first_name,omitzero"`
	LastName     Nullable[string] `json:"last_name,omitzero"`
	CreatedAt    string           `json:"created_at"`
	Unsubscribed bool             `json:"unsubscribed"`
	// Disposable: The address is on a known throwaway-mailbox domain (set when the contact is created).
	Disposable bool `json:"disposable"`
	// Suppressed: The address is on the suppression list
	Suppressed bool `json:"suppressed"`
	// Segments: The manual segments the contact is in. Lists and GET /v1/contacts/{id} return it.
	Segments    []ContactSegmentsItem        `json:"segments,omitzero"`
	Object      *string                      `json:"object,omitzero"`
	Properties  map[string]any               `json:"properties,omitzero"`
	Suppression Nullable[ContactSuppression] `json:"suppression,omitzero"`
}

type ContactBatchCreated

type ContactBatchCreated struct {
	Object  string           `json:"object"`
	HasMore bool             `json:"has_more"`
	Data    []ContactSummary `json:"data"`
}

type ContactCreated

type ContactCreated struct {
	Object string `json:"object"`
	ID     string `json:"id"`
}

type ContactDeleted

type ContactDeleted struct {
	Object  string `json:"object"`
	Contact string `json:"contact"`
	Deleted bool   `json:"deleted"`
}

type ContactExport

type ContactExport struct {
	Object string `json:"object"`
	// HasMore: True when more than 10,000 contacts matched and the export stopped there
	HasMore    bool              `json:"has_more"`
	Data       []ContactListItem `json:"data"`
	ExportedAt string            `json:"exported_at"`
}

type ContactList

type ContactList struct {
	Object   string            `json:"object"`
	HasMore  bool              `json:"has_more"`
	Data     []ContactListItem `json:"data"`
	Page     *int64            `json:"page,omitzero"`
	PageSize *int64            `json:"page_size,omitzero"`
	// FilteredTotal: Contacts matching the filters
	FilteredTotal *int64 `json:"filtered_total,omitzero"`
	// Total: Every contact of the team
	Total        *int64 `json:"total,omitzero"`
	Subscribed   *int64 `json:"subscribed,omitzero"`
	Unsubscribed *int64 `json:"unsubscribed,omitzero"`
	// Disposable: Subscribed contacts on throwaway-mailbox domains
	Disposable *int64 `json:"disposable,omitzero"`
	// New7d: Subscribed contacts added in the last 7 days
	New7d *int64 `json:"new_7d,omitzero"`
	// New30d: Subscribed contacts added in the last 30 days
	New30d *int64 `json:"new_30d,omitzero"`
	// ContactLimit: The plan's contact limit, with any override for the account
	ContactLimit *int64 `json:"contact_limit,omitzero"`
	// ContactLimitBase: The plan's contact limit without overrides
	ContactLimitBase *int64  `json:"contact_limit_base,omitzero"`
	Tier             *string `json:"tier,omitzero"`
}

type ContactListItem

type ContactListItem struct {
	ID           string           `json:"id"`
	Email        string           `json:"email"`
	FirstName    Nullable[string] `json:"first_name,omitzero"`
	LastName     Nullable[string] `json:"last_name,omitzero"`
	CreatedAt    string           `json:"created_at"`
	Unsubscribed bool             `json:"unsubscribed"`
	// Disposable: The address is on a known throwaway-mailbox domain (set when the contact is created).
	Disposable bool `json:"disposable"`
	// Suppressed: The address is on the suppression list
	Suppressed bool `json:"suppressed"`
	// Segments: The manual segments the contact is in. Lists and GET /v1/contacts/{id} return it.
	Segments    []ContactListItemSegmentsItem `json:"segments"`
	Properties  map[string]any                `json:"properties"`
	Suppression *ContactSuppression           `json:"suppression"`
}

ContactListItem: A contact as lists return it: the summary fields plus properties, segments and the suppression.

type ContactListItemSegmentsItem

type ContactListItemSegmentsItem struct {
	ID    string  `json:"id"`
	Name  string  `json:"name"`
	Color *string `json:"color"`
}

type ContactPropertiesService

type ContactPropertiesService struct {
	// contains filtered or unexported fields
}

ContactPropertiesService groups the contactProperties operations.

func (*ContactPropertiesService) Create

Create: Declare a contact property (POST /v1/contact-properties).

func (*ContactPropertiesService) Delete

func (s *ContactPropertiesService) Delete(ctx context.Context, id string, opts ...RequestOption) (*Success, error)

Delete: Delete a contact property (DELETE /v1/contact-properties/{id}).

func (*ContactPropertiesService) Get

Get: Get a contact property (GET /v1/contact-properties/{id}).

func (*ContactPropertiesService) List

List: List contact properties (GET /v1/contact-properties).

func (*ContactPropertiesService) Update

Update: Update a contact property default (PATCH /v1/contact-properties/{id}).

type ContactProperty

type ContactProperty struct {
	ID   string `json:"id"`
	Key  string `json:"key"`
	Type string `json:"type"`
	// FallbackValue: Used when a contact has no value. A number for a number property; null when unset.
	FallbackValue any    `json:"fallback_value"`
	CreatedAt     string `json:"created_at"`
}

type ContactSegmentsItem

type ContactSegmentsItem struct {
	ID    string  `json:"id"`
	Name  string  `json:"name"`
	Color *string `json:"color"`
}

type ContactSummary

type ContactSummary struct {
	ID           string           `json:"id"`
	Email        string           `json:"email"`
	FirstName    Nullable[string] `json:"first_name,omitzero"`
	LastName     Nullable[string] `json:"last_name,omitzero"`
	CreatedAt    string           `json:"created_at"`
	Unsubscribed bool             `json:"unsubscribed"`
	// Disposable: The address is on a known throwaway-mailbox domain (set when the contact is created).
	Disposable bool `json:"disposable"`
	// Suppressed: The address is on the suppression list
	Suppressed bool `json:"suppressed"`
	// Segments: The manual segments the contact is in. Lists and GET /v1/contacts/{id} return it.
	Segments []ContactSummarySegmentsItem `json:"segments,omitzero"`
}

type ContactSummarySegmentsItem

type ContactSummarySegmentsItem struct {
	ID    string  `json:"id"`
	Name  string  `json:"name"`
	Color *string `json:"color"`
}

type ContactSuppression

type ContactSuppression struct {
	ID     string `json:"id"`
	Reason string `json:"reason"`
	Source string `json:"source"`
	// Scope: all: every send to the address is blocked. marketing: only marketing email is blocked, and email labelled transactional still goes out. A recipient's
	Scope     string `json:"scope"`
	CreatedAt string `json:"created_at"`
}

type ContactsSegmentsService

type ContactsSegmentsService struct {
	// contains filtered or unexported fields
}

ContactsSegmentsService groups the contacts.segments operations.

func (*ContactsSegmentsService) Add

func (s *ContactsSegmentsService) Add(ctx context.Context, id string, segmentID string, opts ...RequestOption) (map[string]any, error)

Add: Add a contact to a segment (POST /v1/contacts/{id}/segments/{segment_id}).

func (*ContactsSegmentsService) List

func (s *ContactsSegmentsService) List(ctx context.Context, id string, opts ...RequestOption) (map[string]any, error)

List: List a contact's segments (GET /v1/contacts/{id}/segments).

func (*ContactsSegmentsService) Remove

func (s *ContactsSegmentsService) Remove(ctx context.Context, id string, segmentID string, opts ...RequestOption) (map[string]any, error)

Remove: Remove a contact from a segment (DELETE /v1/contacts/{id}/segments/{segment_id}).

type ContactsService

type ContactsService struct {
	Segments *ContactsSegmentsService
	// contains filtered or unexported fields
}

ContactsService groups the contacts operations.

func (*ContactsService) Create

Create: Create a contact (POST /v1/contacts).

func (*ContactsService) Delete

func (s *ContactsService) Delete(ctx context.Context, id string, opts ...RequestOption) (*ContactDeleted, error)

Delete: Delete a contact (DELETE /v1/contacts/{id}).

func (*ContactsService) DeleteMany

func (s *ContactsService) DeleteMany(ctx context.Context, params *DeleteContactsParams, opts ...RequestOption) (map[string]any, error)

DeleteMany: Delete contacts in bulk (DELETE /v1/contacts).

func (*ContactsService) Export

Export: Export contacts (GET /v1/contacts/export).

func (*ContactsService) Get

func (s *ContactsService) Get(ctx context.Context, id string, opts ...RequestOption) (*Contact, error)

Get: Retrieve a contact (GET /v1/contacts/{id}).

func (*ContactsService) List

List: List contacts (GET /v1/contacts).

func (*ContactsService) Update

Update: Update a contact (PATCH /v1/contacts/{id}).

type CreateAPIKeyRequest

type CreateAPIKeyRequest struct {
	// Name: A human-readable name for the key
	Name string `json:"name"`
	// Scopes: Optional list of scopes to restrict the key. Available: email:send, email:read, domain:read, domain:write, contact:read, contact:write, form:read, for
	Scopes []string `json:"scopes,omitzero"`
}

type CreateBroadcastRequest

type CreateBroadcastRequest struct {
	Name     *string `json:"name,omitzero"`
	Audience *string `json:"audience,omitzero"`
	// SegmentID: Required when audience is segment
	SegmentID *string `json:"segment_id,omitzero"`
	// AudienceMeta: Details of the audience, such as the segment_id
	AudienceMeta map[string]any `json:"audience_meta,omitzero"`
	// TemplateID: Not in Resend, and only on create (PATCH ignores it). Start from a template (id or alias): its current content, as the template editor shows it, is co
	TemplateID  *string          `json:"template_id,omitzero"`
	From        *string          `json:"from,omitzero"`
	ReplyTo     Nullable[string] `json:"reply_to,omitzero"`
	Subject     *string          `json:"subject,omitzero"`
	PreviewText Nullable[string] `json:"preview_text,omitzero"`
	// Markdown: Markdown body. Must include {{unsubscribe_url}} or {{{RESEND_UNSUBSCRIBE_URL}}} before sending.
	Markdown    *string          `json:"markdown,omitzero"`
	HTML        Nullable[string] `json:"html,omitzero"`
	Text        Nullable[string] `json:"text,omitzero"`
	TrackOpens  *bool            `json:"track_opens,omitzero"`
	TrackClicks *bool            `json:"track_clicks,omitzero"`
	// SendOverMinutes: Not in Resend. Spread the send evenly over this many minutes from the send time (or scheduled_at): recipient i of N goes out at start + i * window / N
	SendOverMinutes Nullable[int64] `json:"send_over_minutes,omitzero"`
}

CreateBroadcastRequest: name is required unless template_id is given.

type CreateContactBatchRequest

type CreateContactBatchRequest struct {
	Contacts []CreateContactRequest `json:"contacts"`
	// SegmentIDs: Manual segments to add every contact to, for contacts that do not name their own
	SegmentIDs []string `json:"segment_ids,omitzero"`
}

CreateContactBatchRequest: Create or update up to 500 contacts, matched by email. Fields sent replace the stored ones; fields left out stay. segment_ids only adds memberships.

type CreateContactParams

type CreateContactParams struct {
	// Email: The contact email address
	Email      *string `json:"email,omitzero"`
	FirstName  *string `json:"firstName,omitzero"`
	LastName   *string `json:"lastName,omitzero"`
	FirstName_ *string `json:"first_name,omitzero"`
	LastName_  *string `json:"last_name,omitzero"`
	// Unsubscribed: Global broadcast subscription status
	Unsubscribed *bool          `json:"unsubscribed,omitzero"`
	Properties   map[string]any `json:"properties,omitzero"`
	// SegmentIDs: Manual segment IDs to assign this contact to
	SegmentIDs []string               `json:"segment_ids,omitzero"`
	Contacts   []CreateContactRequest `json:"contacts,omitzero"`
}

type CreateContactPropertyParams

type CreateContactPropertyParams struct {
	Key  string `json:"key"`
	Type string `json:"type"`
	// FallbackValue: Used when a contact has no value
	FallbackValue Nullable[any] `json:"fallback_value,omitzero"`
}

type CreateContactPropertyResponse

type CreateContactPropertyResponse struct {
	ContactProperty ContactProperty `json:"contact_property"`
}

type CreateContactRequest

type CreateContactRequest struct {
	// Email: The contact email address
	Email      string  `json:"email"`
	FirstName  *string `json:"firstName,omitzero"`
	LastName   *string `json:"lastName,omitzero"`
	FirstName_ *string `json:"first_name,omitzero"`
	LastName_  *string `json:"last_name,omitzero"`
	// Unsubscribed: Global broadcast subscription status
	Unsubscribed *bool          `json:"unsubscribed,omitzero"`
	Properties   map[string]any `json:"properties,omitzero"`
	// SegmentIDs: Manual segment IDs to assign this contact to
	SegmentIDs []string `json:"segment_ids,omitzero"`
}

type CreateContactResponse

type CreateContactResponse struct {
	Object  string           `json:"object"`
	ID      *string          `json:"id,omitzero"`
	HasMore *bool            `json:"has_more,omitzero"`
	Data    []ContactSummary `json:"data,omitzero"`
}

type CreateInboxDraftParams

type CreateInboxDraftParams struct {
	To      Nullable[StringList] `json:"to,omitzero"`
	Cc      Nullable[StringList] `json:"cc,omitzero"`
	Bcc     Nullable[StringList] `json:"bcc,omitzero"`
	Subject Nullable[string]     `json:"subject,omitzero"`
	HTML    Nullable[string]     `json:"html,omitzero"`
	Text    Nullable[string]     `json:"text,omitzero"`
	// ThreadID: The thread to reply in. Send with reply_to_email_id.
	ThreadID *string `json:"thread_id,omitzero"`
	// ReplyToEmailID: The message to reply to. Send with thread_id.
	ReplyToEmailID *string `json:"reply_to_email_id,omitzero"`
}

type CreateInboxLabelParams

type CreateInboxLabelParams struct {
	Name  string  `json:"name"`
	Color *string `json:"color,omitzero"`
}

type CreateInboxParams

type CreateInboxParams struct {
	// EmailAddress: A plain address on one of your domains, such as support@example.com
	EmailAddress string `json:"email_address"`
	// Name: Internal name. Defaults to email_address.
	Name *string `json:"name,omitzero"`
	// FromName: The name recipients see. A plain name, not a Name <email> address.
	FromName *string `json:"from_name,omitzero"`
	// Forwarding: Not available: must be false or omitted. Inboxes receive through your domain's MX record.
	Forwarding *bool `json:"forwarding,omitzero"`
}

type CreateLinkDomainRequest

type CreateLinkDomainRequest struct {
	// Hostname: A subdomain of one of your verified sending domains. One link domain per sending domain.
	Hostname string `json:"hostname"`
}

type CreateSegmentRequest

type CreateSegmentRequest struct {
	Name        string           `json:"name"`
	Description Nullable[string] `json:"description,omitzero"`
	Color       Nullable[string] `json:"color,omitzero"`
}

type CreateSignupFormRequest

type CreateSignupFormRequest struct {
	Name string `json:"name"`
	// Fields: email is always included.
	Fields         []string `json:"fields,omitzero"`
	ButtonText     *string  `json:"button_text,omitzero"`
	ButtonColor    *string  `json:"button_color,omitzero"`
	SuccessMessage *string  `json:"success_message,omitzero"`
	DoubleOptIn    *bool    `json:"double_opt_in,omitzero"`
	// RedirectURL: Must start with http:// or https://.
	RedirectURL Nullable[string] `json:"redirect_url,omitzero"`
	// CaptchaEnabled: Needs turnstile_site_key and turnstile_secret_key.
	CaptchaEnabled   *bool            `json:"captcha_enabled,omitzero"`
	CaptchaProvider  *string          `json:"captcha_provider,omitzero"`
	TurnstileSiteKey Nullable[string] `json:"turnstile_site_key,omitzero"`
	// TurnstileSecretKey: Write-only. Returned forms expose turnstile_secret_configured instead.
	TurnstileSecretKey    Nullable[string] `json:"turnstile_secret_key,omitzero"`
	BlockDisposableEmails *bool            `json:"block_disposable_emails,omitzero"`
	Active                *bool            `json:"active,omitzero"`
	// ConfirmationEmailFrom: Sender of the double opt-in confirmation email. The platform address is used when this is unset or its domain is not verified.
	ConfirmationEmailFrom Nullable[string] `json:"confirmation_email_from,omitzero"`
	// WelcomeEmailEnabled: Send a welcome email to each new contact from this form.
	WelcomeEmailEnabled *bool `json:"welcome_email_enabled,omitzero"`
	// WelcomeEmailFrom: Sender of the welcome email. Its domain must be verified, or the welcome email is skipped.
	WelcomeEmailFrom    Nullable[string] `json:"welcome_email_from,omitzero"`
	WelcomeEmailSubject Nullable[string] `json:"welcome_email_subject,omitzero"`
	// WelcomeEmailMarkdown: Welcome email body as Markdown.
	WelcomeEmailMarkdown Nullable[string] `json:"welcome_email_markdown,omitzero"`
}

CreateSignupFormRequest: Keys are snake_case, as in the form object. The older camelCase spelling of each key (buttonText, doubleOptIn, welcomeEmailEnabled and so on) is still

type CreateSuppressionRequest

type CreateSuppressionRequest struct {
	Email  string  `json:"email"`
	Reason *string `json:"reason,omitzero"`
	// Scope: all blocks every send to the address. marketing blocks marketing email only, like a recipient's own unsubscribe. An address already on the list keeps
	Scope *string `json:"scope,omitzero"`
	// DiagnosticCode: Optional internal note for manual suppressions
	DiagnosticCode *string `json:"diagnostic_code,omitzero"`
}

type CreateTeamInviteParams

type CreateTeamInviteParams struct {
	Email string  `json:"email"`
	Role  *string `json:"role,omitzero"`
}

type CreateTemplateRequest

type CreateTemplateRequest struct {
	Name string `json:"name"`
	// Alias: A second handle, unique in the team, that works wherever the id does.
	Alias Nullable[string] `json:"alias,omitzero"`
	// From: Default sender, e.g. "Acme <orders@acme.com>". A send can override it.
	From Nullable[string] `json:"from,omitzero"`
	// Subject: Default subject. Can use variables. A send can override it.
	Subject Nullable[string] `json:"subject,omitzero"`
	// ReplyTo: Default Reply-To address or addresses. A send can override it.
	ReplyTo Nullable[StringList] `json:"reply_to,omitzero"`
	// HTML: The HTML body. Variables are written {{{KEY}}}, optionally with an inline fallback: {{{KEY|default}}}.
	HTML *string `json:"html,omitzero"`
	// Text: Plain-text body. When left out, the text part is generated from the HTML at send time. Exactly "" stops that, as in Resend; the email then carries an
	Text Nullable[string] `json:"text,omitzero"`
	// Markdown: Not in Resend. A Markdown body, rendered into SMTPfast's email layout. Used when html is empty.
	Markdown Nullable[string] `json:"markdown,omitzero"`
	// PreviewText: Not in Resend. The inbox preview line, put into the email as a hidden first line.
	PreviewText Nullable[string] `json:"preview_text,omitzero"`
	// Category: Not in Resend. A label for grouping templates in the dashboard.
	Category  Nullable[string]   `json:"category,omitzero"`
	Variables []TemplateVariable `json:"variables,omitzero"`
}

CreateTemplateRequest: Requires html, or markdown (an SMTPfast addition).

type CreateWebhookRequest

type CreateWebhookRequest struct {
	// URL: The URL that will receive webhook POST requests
	URL string `json:"url"`
	// Events: List of event types to subscribe to. Legacy unprefixed email aliases are accepted and normalized to Resend-style email.* event names.
	Events []string `json:"events"`
	// Format: Payload format. standard is the signed JSON envelope; discord and slack post readable messages to a chat webhook URL. Detected from the URL when left
	Format *string `json:"format,omitzero"`
}

type DNSRecord

type DNSRecord struct {
	Type  string  `json:"type"`
	Name  string  `json:"name"`
	Value string  `json:"value"`
	Ttl   *string `json:"ttl,omitzero"`
	// Priority: Set for MX records
	Priority Nullable[int64] `json:"priority,omitzero"`
	// Status: The verification status that covers this record
	Status *string `json:"status,omitzero"`
	// Purpose: DKIM authentication, SPF authorization, DMARC policy, MAIL FROM bounce delivery, MAIL FROM SPF or Inbound mail
	Purpose  *string `json:"purpose,omitzero"`
	Category *string `json:"category,omitzero"`
	// ActualValue: GET /v1/domains/{id} only: what DNS answers now, several values joined with " | "
	ActualValue Nullable[string] `json:"actual_value,omitzero"`
	// LiveCheck: GET /v1/domains/{id} only: how the live value compares with the expected one. Null for the inbound MX record.
	LiveCheck Nullable[string] `json:"live_check,omitzero"`
	// ActualValue_: Same as actual_value, for older clients
	ActualValue_ Nullable[string] `json:"actualValue,omitzero"`
	// LiveCheck_: Same as live_check, for older clients
	LiveCheck_ Nullable[string] `json:"liveCheck,omitzero"`
}

type DeleteContactsParams

type DeleteContactsParams struct {
	IDs     []string `json:"ids,omitzero"`
	Confirm *string  `json:"confirm,omitzero"`
	Status  *string  `json:"status,omitzero"`
}

type DeleteInboxDraftResponse

type DeleteInboxDraftResponse struct {
	Object  *string `json:"object,omitzero"`
	ID      *string `json:"id,omitzero"`
	Deleted *bool   `json:"deleted,omitzero"`
}

type DeleteInboxLabelResponse

type DeleteInboxLabelResponse struct {
	Object  *string `json:"object,omitzero"`
	ID      *string `json:"id,omitzero"`
	Deleted *bool   `json:"deleted,omitzero"`
}

type DeleteInboxResponse

type DeleteInboxResponse struct {
	Object  *string `json:"object,omitzero"`
	ID      *string `json:"id,omitzero"`
	Deleted *bool   `json:"deleted,omitzero"`
}

type DeleteInboxThreadResponse

type DeleteInboxThreadResponse struct {
	Object  *string `json:"object,omitzero"`
	ID      *string `json:"id,omitzero"`
	Deleted *bool   `json:"deleted,omitzero"`
}

type DeleteReceivedEmailResponse

type DeleteReceivedEmailResponse struct {
	Object  *string `json:"object,omitzero"`
	ID      *string `json:"id,omitzero"`
	Deleted *bool   `json:"deleted,omitzero"`
}

type DeletedObject

type DeletedObject struct {
	Object  *string `json:"object,omitzero"`
	ID      *string `json:"id,omitzero"`
	Deleted *bool   `json:"deleted,omitzero"`
}

type Domain

type Domain struct {
	ID     string `json:"id"`
	Domain string `json:"domain"`
	// Name: Same as domain. Resend calls this field name.
	Name *string `json:"name,omitzero"`
	// Status: GET /v1/domains/{id} answers pending for a verified domain whose required records are no longer live.
	Status string `json:"status"`
	// Receiving: Inbound email for the domain
	Receiving           *DomainReceiving `json:"receiving,omitzero"`
	VerificationPhase   *string          `json:"verification_phase,omitzero"`
	VerificationMessage *string          `json:"verification_message,omitzero"`
	// NextAutoCheckAt: Null once the domain is verified
	NextAutoCheckAt Nullable[string] `json:"next_auto_check_at,omitzero"`
	DKIMStatus      *string          `json:"dkim_status,omitzero"`
	SPFStatus       *string          `json:"spf_status,omitzero"`
	DMARCStatus     *string          `json:"dmarc_status,omitzero"`
	MailFromStatus  *string          `json:"mail_from_status,omitzero"`
	MailFromDomain  Nullable[string] `json:"mail_from_domain,omitzero"`
	VerifiedAt      Nullable[string] `json:"verified_at,omitzero"`
	Region          *string          `json:"region,omitzero"`
	// Provider: The DNS provider found from the NS records
	Provider *DomainProvider `json:"provider,omitzero"`
	// Events: The verification steps and when each was done
	Events        []DomainEventsItem `json:"events,omitzero"`
	DNSRecords    []DNSRecord        `json:"dns_records"`
	CreatedAt     string             `json:"created_at"`
	LastCheckedAt Nullable[string]   `json:"last_checked_at,omitzero"`
}

Domain: POST /v1/domains returns id, domain, status, dns_records and created_at. GET /v1/domains/{id} adds the verification detail, a live DNS check of each r

type DomainEventsItem

type DomainEventsItem struct {
	Key   *string          `json:"key,omitzero"`
	Label *string          `json:"label,omitzero"`
	At    Nullable[string] `json:"at,omitzero"`
	Done  *bool            `json:"done,omitzero"`
}

type DomainListItem

type DomainListItem struct {
	ID     string `json:"id"`
	Domain string `json:"domain"`
	// Name: Same as domain. Resend calls this field name.
	Name *string `json:"name,omitzero"`
	// Status: pending, verifying, verified or failed
	Status           string  `json:"status"`
	DKIMStatus       string  `json:"dkim_status"`
	SPFStatus        string  `json:"spf_status"`
	DMARCStatus      string  `json:"dmarc_status"`
	VerifiedAt       *string `json:"verified_at"`
	CreatedAt        string  `json:"created_at"`
	ReceivingEnabled bool    `json:"receiving_enabled"`
	// ReceivingStatus: disabled, pending, active or failed
	ReceivingStatus string `json:"receiving_status"`
}

DomainListItem: A domain as the list returns it. GET /v1/domains/{id} has the DNS records and verification detail.

type DomainProvider

type DomainProvider struct {
	ID    *string `json:"id,omitzero"`
	Name  *string `json:"name,omitzero"`
	Badge *string `json:"badge,omitzero"`
	Zone  *string `json:"zone,omitzero"`
}

DomainProvider: The DNS provider found from the NS records

type DomainReceiving

type DomainReceiving struct {
	Enabled     *bool                            `json:"enabled,omitzero"`
	Status      *string                          `json:"status,omitzero"`
	MXRecord    *DomainReceivingMXRecord         `json:"mx_record,omitzero"`
	PublishedMX []DomainReceivingPublishedMXItem `json:"published_mx,omitzero"`
	CompetingMX []string                         `json:"competing_mx,omitzero"`
}

type DomainReceivingMXRecord

type DomainReceivingMXRecord struct {
	Type     *string `json:"type,omitzero"`
	Priority *int64  `json:"priority,omitzero"`
	Value    *string `json:"value,omitzero"`
}

type DomainReceivingPublishedMXItem

type DomainReceivingPublishedMXItem struct {
	Priority *int64  `json:"priority,omitzero"`
	Exchange *string `json:"exchange,omitzero"`
}

type DomainsService

type DomainsService struct {
	// contains filtered or unexported fields
}

DomainsService groups the domains operations.

func (*DomainsService) Claim

Claim: Claim a domain held by another account (POST /v1/domains/claim).

func (*DomainsService) ConnectCloudflare

func (s *DomainsService) ConnectCloudflare(ctx context.Context, id string, opts ...RequestOption) (map[string]any, error)

ConnectCloudflare: Set up sending DNS on Cloudflare in one click (POST /v1/domains/{id}/domain-connect/cloudflare).

func (*DomainsService) ConnectCloudflareInbound

func (s *DomainsService) ConnectCloudflareInbound(ctx context.Context, id string, opts ...RequestOption) (map[string]any, error)

ConnectCloudflareInbound: Set up receiving DNS on Cloudflare in one click (POST /v1/domains/{id}/domain-connect/cloudflare-inbound).

func (*DomainsService) Create

func (s *DomainsService) Create(ctx context.Context, params *AddDomainRequest, opts ...RequestOption) (*Domain, error)

Create: Add a domain (POST /v1/domains).

func (*DomainsService) Delete

func (s *DomainsService) Delete(ctx context.Context, id string, opts ...RequestOption) (map[string]any, error)

Delete: Delete a domain (DELETE /v1/domains/{id}).

func (*DomainsService) Get

func (s *DomainsService) Get(ctx context.Context, id string, opts ...RequestOption) (*Domain, error)

Get: Get domain details (GET /v1/domains/{id}).

func (*DomainsService) GetClaimRecord

GetClaimRecord: Get the claim record for a domain (GET /v1/domains/claim).

func (*DomainsService) List

List: List domains (GET /v1/domains).

func (*DomainsService) Update

Update: Turn inbound receiving on or off (PATCH /v1/domains/{id}).

func (*DomainsService) Verify

Verify: Verify a domain (POST /v1/domains/{id}/verify).

type DuplicateBroadcastResponse

type DuplicateBroadcastResponse struct {
	Broadcast Broadcast `json:"broadcast"`
}

type Email

type Email struct {
	ID string `json:"id"`
	// From: As sent, so it can include a display name: Name <hello@yourapp.com>
	From    string   `json:"from"`
	To      []string `json:"to"`
	Cc      []string `json:"cc"`
	Bcc     []string `json:"bcc"`
	Subject string   `json:"subject"`
	// HTML: The stored body. For an API send the {{unsubscribe_url}} placeholder is filled in when the email goes out, so it appears here unreplaced; broadcast an
	HTML *string `json:"html"`
	// Text: The stored plain-text body, null when there was none or the retention window removed it.
	Text      *string `json:"text"`
	CreatedAt string  `json:"created_at"`
	// LastEvent: The type of the newest event, or the status when the email has no events yet. Resend-compatible.
	LastEvent string `json:"last_event"`
	// BodyClearedAt: When the retention window removed html and text. Null while the body is kept, so null html and text with a timestamp here means the content is no long
	BodyClearedAt *string `json:"body_cleared_at"`
	// Source: api, smtp, dashboard, broadcast or broadcast_test
	Source string `json:"source"`
	// Category: Decides which suppressions apply and whether the List-Unsubscribe header went out. marketing unless the email was labelled transactional; broadcasts,
	Category string `json:"category"`
	Status   string `json:"status"`
	// ReplyTo: The Reply-To address the email was sent with, or null.
	ReplyTo *string `json:"reply_to"`
	// Tags: The tags given at send time, as name/value pairs. Empty when none were given.
	Tags []EmailTagsItem `json:"tags"`
	// MessageID: The RFC 5322 Message-ID on your sending domain, the one a recipient's server and bounce reports quote. Null until the email is sent.
	MessageID *string `json:"message_id"`
	// SesMessageID: The Amazon SES message id. Kept for older integrations; correlate with message_id.
	SesMessageID *string `json:"ses_message_id"`
	SentAt       *string `json:"sent_at"`
	DeliveredAt  *string `json:"delivered_at"`
	OpenedAt     *string `json:"opened_at"`
	ClickedAt    *string `json:"clicked_at"`
	BouncedAt    *string `json:"bounced_at"`
	// UnsubscribedAt: When the recipient unsubscribed through this email. status keeps its delivery value.
	UnsubscribedAt *string `json:"unsubscribed_at"`
	ErrorMessage   *string `json:"error_message"`
	// Events: Every event of the email, oldest first.
	Events []EmailEventsItem `json:"events"`
}

type EmailEventsItem

type EmailEventsItem struct {
	// Type: queued, scheduled, sending, retrying, sent, delivered, delivery_delayed, bounced, complained, opened, clicked, failed, suppressed or unsubscribed
	Type string `json:"type"`
	// Metadata: Event details such as the bounce type or the clicked URL
	Metadata  map[string]any `json:"metadata"`
	Timestamp string         `json:"timestamp"`
}

type EmailList

type EmailList struct {
	Object string         `json:"object"`
	Data   []EmailSummary `json:"data"`
	// Page: Absent when paging with after or before
	Page  *int64 `json:"page,omitzero"`
	Limit int64  `json:"limit"`
	// Total: Emails matching the filters; with after or before, only those past that email
	Total   int64 `json:"total"`
	HasMore bool  `json:"has_more"`
}

type EmailSummary

type EmailSummary struct {
	ID      string   `json:"id"`
	From    string   `json:"from"`
	To      []string `json:"to"`
	Subject string   `json:"subject"`
	// Status: queued, scheduled, sending, sent, delivered, opened, clicked, bounced, complained, failed or canceled
	Status string `json:"status"`
	// Source: api, smtp, dashboard, broadcast or broadcast_test
	Source       string  `json:"source"`
	Category     string  `json:"category"`
	CreatedAt    string  `json:"created_at"`
	SentAt       *string `json:"sent_at"`
	DeliveredAt  *string `json:"delivered_at"`
	OpenedAt     *string `json:"opened_at"`
	ClickedAt    *string `json:"clicked_at"`
	BouncedAt    *string `json:"bounced_at"`
	ErrorMessage *string `json:"error_message"`
}

type EmailTagsItem

type EmailTagsItem struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type EmailsReceivingAttachmentsService

type EmailsReceivingAttachmentsService struct {
	// contains filtered or unexported fields
}

EmailsReceivingAttachmentsService groups the emails.receiving.attachments operations.

func (*EmailsReceivingAttachmentsService) Get

Get: Get one attachment of a received email (GET /v1/emails/receiving/{id}/attachments/{attachment_id}).

func (*EmailsReceivingAttachmentsService) List

List: List attachments of a received email (GET /v1/emails/receiving/{id}/attachments).

type EmailsReceivingService

type EmailsReceivingService struct {
	Attachments *EmailsReceivingAttachmentsService
	// contains filtered or unexported fields
}

EmailsReceivingService groups the emails.receiving operations.

func (*EmailsReceivingService) Delete

Delete: Delete a received email (DELETE /v1/emails/receiving/{id}).

func (*EmailsReceivingService) Get

Get: Get a received email (GET /v1/emails/receiving/{id}).

func (*EmailsReceivingService) List

List: List received emails (GET /v1/emails/receiving).

func (*EmailsReceivingService) ListAll

ListAll iterates over every item of List, fetching the following pages as needed.

func (*EmailsReceivingService) Mark

Mark: Mark received emails read or unread (PATCH /v1/emails/receiving).

func (*EmailsReceivingService) Reply

Reply: Reply to a received email (POST /v1/emails/receiving/{id}/reply).

func (*EmailsReceivingService) Update

Update: Mark a received email read or unread (PATCH /v1/emails/receiving/{id}).

type EmailsService

type EmailsService struct {
	Receiving *EmailsReceivingService
	// contains filtered or unexported fields
}

EmailsService groups the emails operations.

func (*EmailsService) Cancel

func (s *EmailsService) Cancel(ctx context.Context, id string, opts ...RequestOption) (*CancelEmailResponse, error)

Cancel: Cancel a scheduled email (POST /v1/emails/{id}/cancel).

func (*EmailsService) Get

func (s *EmailsService) Get(ctx context.Context, id string, opts ...RequestOption) (*Email, error)

Get: Get email details (GET /v1/emails/{id}).

func (*EmailsService) GetMetrics

GetMetrics: Retrieve email metrics (GET /v1/emails/metrics).

func (*EmailsService) List

func (s *EmailsService) List(ctx context.Context, query *ListEmailsQuery, opts ...RequestOption) (*EmailList, error)

List: List sent emails (GET /v1/emails).

func (*EmailsService) ListAll

ListAll iterates over every item of List, fetching the following pages as needed.

func (s *EmailsService) ListClickedLinks(ctx context.Context, query *ListClickedLinksQuery, opts ...RequestOption) (map[string]any, error)

ListClickedLinks: List clicked links (GET /v1/emails/clicked-links).

func (*EmailsService) Send

Send: Send an email (POST /v1/emails).

func (*EmailsService) SendBatch

func (s *EmailsService) SendBatch(ctx context.Context, params []SendEmailRequest, opts ...RequestOption) (*BatchSendResponse, error)

SendBatch: Send a batch of emails (POST /v1/emails/batch).

func (*EmailsService) Share

Share: Create a share link for a sent email (POST /v1/emails/{id}/share).

func (*EmailsService) Update

Update: Reschedule a scheduled email (PATCH /v1/emails/{id}).

type Error

type Error struct {
	// Error: A human-readable error message
	Error string `json:"error"`
}

type ExportContactsQuery

type ExportContactsQuery struct {
	Format     *string `json:"format,omitzero"`
	Status     *string `json:"status,omitzero"`
	Disposable *bool   `json:"disposable,omitzero"`
}

type FormsPendingService

type FormsPendingService struct {
	// contains filtered or unexported fields
}

FormsPendingService groups the forms.pending operations.

func (*FormsPendingService) Approve

Approve: Approve a pending signup (POST /v1/forms/{id}/pending/{pendingId}/approve).

func (*FormsPendingService) ApproveAll

ApproveAll: Approve all pending signups (POST /v1/forms/{id}/pending/approve-all).

func (*FormsPendingService) List

List: List pending signups (GET /v1/forms/{id}/pending).

func (*FormsPendingService) Remove

Remove: Remove a pending signup (DELETE /v1/forms/{id}/pending/{pendingId}).

type FormsService

type FormsService struct {
	Pending *FormsPendingService
	// contains filtered or unexported fields
}

FormsService groups the forms operations.

func (*FormsService) Create

func (s *FormsService) Create(ctx context.Context, params *CreateSignupFormRequest, opts ...RequestOption) (*SignupForm, error)

Create: Create a signup form (POST /v1/forms).

func (*FormsService) Delete

func (s *FormsService) Delete(ctx context.Context, id string, opts ...RequestOption) (*SignupFormDeleted, error)

Delete: Delete a signup form (DELETE /v1/forms/{id}).

func (*FormsService) Get

func (s *FormsService) Get(ctx context.Context, id string, opts ...RequestOption) (*SignupForm, error)

Get: Retrieve a signup form (GET /v1/forms/{id}).

func (*FormsService) List

func (s *FormsService) List(ctx context.Context, opts ...RequestOption) (*SignupFormList, error)

List: List signup forms (GET /v1/forms).

func (*FormsService) PreviewWelcomeEmail

func (s *FormsService) PreviewWelcomeEmail(ctx context.Context, id string, params *PreviewFormWelcomeEmailParams, opts ...RequestOption) (map[string]any, error)

PreviewWelcomeEmail: Preview a form's welcome email (POST /v1/forms/{id}/welcome-preview).

func (*FormsService) Update

func (s *FormsService) Update(ctx context.Context, id string, params *UpdateSignupFormRequest, opts ...RequestOption) (*SignupForm, error)

Update: Update a signup form (PATCH /v1/forms/{id}).

type ForwardInboxThreadEmailParams

type ForwardInboxThreadEmailParams struct {
	To      StringList `json:"to"`
	Cc      StringList `json:"cc,omitzero"`
	Bcc     StringList `json:"bcc,omitzero"`
	HTML    *string    `json:"html,omitzero"`
	Text    *string    `json:"text,omitzero"`
	Subject *string    `json:"subject,omitzero"`
}

type GetAnalyticsQuery

type GetAnalyticsQuery struct {
	Days   *int64  `json:"days,omitzero"`
	Domain *string `json:"domain,omitzero"`
}

type GetBroadcastAudienceQuery

type GetBroadcastAudienceQuery struct {
	SegmentID *string `json:"segment_id,omitzero"`
}

type GetCapabilitiesResponse

type GetCapabilitiesResponse struct {
	APIKeyID string `json:"api_key_id"`
	// UserID: The user who created the key. Matches user_id on GET /v1/team/members.
	UserID            string                         `json:"user_id"`
	Scopes            []string                       `json:"scopes"`
	TeamID            *string                        `json:"team_id"`
	TeamSendingStatus *string                        `json:"team_sending_status"`
	Account           GetCapabilitiesResponseAccount `json:"account"`
	// SendChecks: Which send-time safety checks apply to this account.
	SendChecks GetCapabilitiesResponseSendChecks `json:"send_checks"`
	RateLimit  GetCapabilitiesResponseRateLimit  `json:"rate_limit"`
}

type GetCapabilitiesResponseAccount

type GetCapabilitiesResponseAccount struct {
	Tier   *string `json:"tier,omitzero"`
	Status *string `json:"status,omitzero"`
}

type GetCapabilitiesResponseRateLimit

type GetCapabilitiesResponseRateLimit struct {
	PerSecond *int64 `json:"per_second,omitzero"`
	Remaining *int64 `json:"remaining,omitzero"`
	// Reset: When the current one-second window resets, in milliseconds since the epoch.
	Reset *int64 `json:"reset,omitzero"`
}

type GetCapabilitiesResponseSendChecks

type GetCapabilitiesResponseSendChecks struct {
	DisplayNameEnforced *bool `json:"display_name_enforced,omitzero"`
	LinkScanEnforced    *bool `json:"link_scan_enforced,omitzero"`
}

GetCapabilitiesResponseSendChecks: Which send-time safety checks apply to this account.

type GetContactPropertyResponse

type GetContactPropertyResponse struct {
	ContactProperty ContactProperty `json:"contact_property"`
}

type GetDomainClaimRecordQuery

type GetDomainClaimRecordQuery struct {
	Domain *string `json:"domain,omitzero"`
}

type GetDomainClaimRecordResponse

type GetDomainClaimRecordResponse struct {
	Domain *string                             `json:"domain,omitzero"`
	Record *GetDomainClaimRecordResponseRecord `json:"record,omitzero"`
}

type GetDomainClaimRecordResponseRecord

type GetDomainClaimRecordResponseRecord struct {
	Type  *string `json:"type,omitzero"`
	Name  *string `json:"name,omitzero"`
	Value *string `json:"value,omitzero"`
	Ttl   *string `json:"ttl,omitzero"`
}

type GetEmailMetricsQuery

type GetEmailMetricsQuery struct {
	StartDate   *string `json:"start_date,omitzero"`
	EndDate     *string `json:"end_date,omitzero"`
	Timezone    *string `json:"timezone,omitzero"`
	Granularity *string `json:"granularity,omitzero"`
	Metrics     *string `json:"metrics,omitzero"`
	Dimensions  *string `json:"dimensions,omitzero"`
	DomainID    *string `json:"domain_id,omitzero"`
	EmailID     *string `json:"email_id,omitzero"`
	BroadcastID *string `json:"broadcast_id,omitzero"`
}

type GetEmailMetricsResponse

type GetEmailMetricsResponse struct {
	Object      string   `json:"object"`
	StartDate   string   `json:"start_date"`
	EndDate     string   `json:"end_date"`
	Timezone    string   `json:"timezone"`
	Metrics     []string `json:"metrics"`
	Dimensions  []string `json:"dimensions"`
	Granularity string   `json:"granularity"`
	// Totals: One value per requested metric: counts are integers, rates percentages with one decimal.
	Totals map[string]float64 `json:"totals"`
	// Data: One row per combination of the requested dimensions, with the requested metrics. Absent when no dimensions are requested.
	Data []GetEmailMetricsResponseDataItem `json:"data,omitzero"`
}

type GetEmailMetricsResponseDataItem

type GetEmailMetricsResponseDataItem struct {
	// Period: With the period dimension
	Period Nullable[string] `json:"period,omitzero"`
	// DomainID: With the domain dimension
	DomainID Nullable[string] `json:"domain_id,omitzero"`
	// DomainName: With the domain dimension
	DomainName Nullable[string] `json:"domain_name,omitzero"`
	// EmailID: With the email dimension
	EmailID Nullable[string] `json:"email_id,omitzero"`
	// BroadcastID: With the broadcast dimension
	BroadcastID Nullable[string] `json:"broadcast_id,omitzero"`
	// BroadcastName: With the broadcast dimension
	BroadcastName Nullable[string] `json:"broadcast_name,omitzero"`
}

type GetWebhookDeliveryResponse

type GetWebhookDeliveryResponse struct {
	Object      *string          `json:"object,omitzero"`
	ID          *string          `json:"id,omitzero"`
	WebhookID   *string          `json:"webhook_id,omitzero"`
	Event       *string          `json:"event,omitzero"`
	Status      *string          `json:"status,omitzero"`
	Attempts    *int64           `json:"attempts,omitzero"`
	MaxAttempts *int64           `json:"max_attempts,omitzero"`
	StatusCode  Nullable[int64]  `json:"status_code,omitzero"`
	DurationMs  Nullable[int64]  `json:"duration_ms,omitzero"`
	Error       Nullable[string] `json:"error,omitzero"`
	// Response: First 500 characters of the last response body
	Response      Nullable[string]                           `json:"response,omitzero"`
	AttemptLog    []GetWebhookDeliveryResponseAttemptLogItem `json:"attempt_log,omitzero"`
	NextAttemptAt Nullable[string]                           `json:"next_attempt_at,omitzero"`
	DeliveredAt   Nullable[string]                           `json:"delivered_at,omitzero"`
	CreatedAt     *string                                    `json:"created_at,omitzero"`
	// Payload: The JSON body as sent
	Payload *string `json:"payload,omitzero"`
}

type GetWebhookDeliveryResponseAttemptLogItem

type GetWebhookDeliveryResponseAttemptLogItem struct {
	At         *string          `json:"at,omitzero"`
	StatusCode Nullable[int64]  `json:"status_code,omitzero"`
	DurationMs *int64           `json:"duration_ms,omitzero"`
	Error      Nullable[string] `json:"error,omitzero"`
}

type Inbox

type Inbox struct {
	Object       *string `json:"object,omitzero"`
	ID           *string `json:"id,omitzero"`
	Name         *string `json:"name,omitzero"`
	EmailAddress *string `json:"email_address,omitzero"`
	DomainID     *string `json:"domain_id,omitzero"`
	// ReceivingAddress: Always null: SMTPfast inboxes receive through your own MX record, never a forwarding address.
	ReceivingAddress Nullable[any]    `json:"receiving_address,omitzero"`
	FromName         Nullable[string] `json:"from_name,omitzero"`
	// Unread: Threads in the inbox folder with at least one unread message
	Unread *int64 `json:"unread,omitzero"`
	// Drafts: Unsent drafts
	Drafts *int64 `json:"drafts,omitzero"`
	// LastReceived: When a thread in this inbox was last active
	LastReceived Nullable[string] `json:"last_received,omitzero"`
	CreatedAt    *string          `json:"created_at,omitzero"`
}

type InboxDraft

type InboxDraft struct {
	Object         *string            `json:"object,omitzero"`
	ID             *string            `json:"id,omitzero"`
	Type           *string            `json:"type,omitzero"`
	To             Nullable[[]string] `json:"to,omitzero"`
	Cc             []string           `json:"cc,omitzero"`
	Bcc            []string           `json:"bcc,omitzero"`
	Subject        Nullable[string]   `json:"subject,omitzero"`
	HTML           Nullable[string]   `json:"html,omitzero"`
	Text           Nullable[string]   `json:"text,omitzero"`
	ThreadID       Nullable[string]   `json:"thread_id,omitzero"`
	ReplyToEmailID Nullable[string]   `json:"reply_to_email_id,omitzero"`
	// EmailID: The queued email once sent
	EmailID   Nullable[string] `json:"email_id,omitzero"`
	CreatedAt *string          `json:"created_at,omitzero"`
	UpdatedAt *string          `json:"updated_at,omitzero"`
	// CreatedVia: Who wrote the draft. Not in Resend.
	CreatedVia *string `json:"created_via,omitzero"`
	// SentAt: Not in Resend
	SentAt Nullable[string] `json:"sent_at,omitzero"`
	// Revision: Goes up with every edit. Pass it to send or update to act only on this version. Not in Resend.
	Revision *int64 `json:"revision,omitzero"`
	// ThreadSubject: The subject of the thread a reply draft answers. Not in Resend.
	ThreadSubject Nullable[string] `json:"thread_subject,omitzero"`
}

type InboxDraftListItem

type InboxDraftListItem struct {
	ID             *string            `json:"id,omitzero"`
	Type           *string            `json:"type,omitzero"`
	To             Nullable[[]string] `json:"to,omitzero"`
	Cc             []string           `json:"cc,omitzero"`
	Bcc            []string           `json:"bcc,omitzero"`
	Subject        Nullable[string]   `json:"subject,omitzero"`
	Snippet        Nullable[string]   `json:"snippet,omitzero"`
	ThreadID       Nullable[string]   `json:"thread_id,omitzero"`
	ReplyToEmailID Nullable[string]   `json:"reply_to_email_id,omitzero"`
	UpdatedAt      *string            `json:"updated_at,omitzero"`
	// CreatedVia: Not in Resend
	CreatedVia *string `json:"created_via,omitzero"`
	// CreatedAt: Not in Resend
	CreatedAt *string `json:"created_at,omitzero"`
	// Revision: Not in Resend
	Revision *int64 `json:"revision,omitzero"`
	// ThreadSubject: Not in Resend
	ThreadSubject Nullable[string] `json:"thread_subject,omitzero"`
}

type InboxLabel

type InboxLabel struct {
	Object    *string `json:"object,omitzero"`
	ID        *string `json:"id,omitzero"`
	Name      *string `json:"name,omitzero"`
	Color     *string `json:"color,omitzero"`
	CreatedAt *string `json:"created_at,omitzero"`
}

type InboxLabelRef

type InboxLabelRef struct {
	ID    *string `json:"id,omitzero"`
	Name  *string `json:"name,omitzero"`
	Color *string `json:"color,omitzero"`
}

type InboxListItem

type InboxListItem struct {
	ID           *string          `json:"id,omitzero"`
	Name         Nullable[string] `json:"name,omitzero"`
	EmailAddress *string          `json:"email_address,omitzero"`
	FromName     Nullable[string] `json:"from_name,omitzero"`
	Unread       *int64           `json:"unread,omitzero"`
	LastReceived Nullable[string] `json:"last_received,omitzero"`
	// DomainID: Not in Resend's list item
	DomainID *string `json:"domain_id,omitzero"`
	// Drafts: Not in Resend's list item
	Drafts *int64 `json:"drafts,omitzero"`
	// CreatedAt: Not in Resend's list item
	CreatedAt *string `json:"created_at,omitzero"`
}

type InboxSentEmail

type InboxSentEmail struct {
	// ID: For a received message, also its id under /v1/emails/receiving
	ID          *string                         `json:"id,omitzero"`
	Direction   *string                         `json:"direction,omitzero"`
	From        *string                         `json:"from,omitzero"`
	To          []string                        `json:"to,omitzero"`
	Cc          []string                        `json:"cc,omitzero"`
	Bcc         []string                        `json:"bcc,omitzero"`
	ReplyTo     []string                        `json:"reply_to,omitzero"`
	Subject     Nullable[string]                `json:"subject,omitzero"`
	MessageID   Nullable[string]                `json:"message_id,omitzero"`
	HTML        Nullable[string]                `json:"html,omitzero"`
	Text        Nullable[string]                `json:"text,omitzero"`
	Attachments []InboxSentEmailAttachmentsItem `json:"attachments,omitzero"`
	Read        *bool                           `json:"read,omitzero"`
	ReceivedAt  *string                         `json:"received_at,omitzero"`
	// Status: delivered or quarantined for a received message, the send status for a sent one. Not in Resend.
	Status *string `json:"status,omitzero"`
	// Verdicts: SES authentication and scan verdicts of a received message (null for sent ones). Not in Resend.
	Verdicts Nullable[InboxSentEmailVerdicts] `json:"verdicts,omitzero"`
	// InReplyTo: Not in Resend
	InReplyTo Nullable[string] `json:"in_reply_to,omitzero"`
	// EmailID: Same as id; the email in GET /v1/emails/{id}
	EmailID *string `json:"email_id,omitzero"`
	// ThreadID: Not in Resend
	ThreadID *string `json:"thread_id,omitzero"`
}

type InboxSentEmailAttachmentsItem

type InboxSentEmailAttachmentsItem struct {
	ID          *string          `json:"id,omitzero"`
	Filename    Nullable[string] `json:"filename,omitzero"`
	Size        Nullable[int64]  `json:"size,omitzero"`
	ContentType Nullable[string] `json:"content_type,omitzero"`
}

type InboxSentEmailVerdicts

type InboxSentEmailVerdicts struct {
	SPF   Nullable[string] `json:"spf,omitzero"`
	DKIM  Nullable[string] `json:"dkim,omitzero"`
	DMARC Nullable[string] `json:"dmarc,omitzero"`
	Spam  Nullable[string] `json:"spam,omitzero"`
	Virus Nullable[string] `json:"virus,omitzero"`
}

InboxSentEmailVerdicts: SES authentication and scan verdicts of a received message (null for sent ones). Not in Resend.

type InboxThread

type InboxThread struct {
	Object  *string          `json:"object,omitzero"`
	ID      *string          `json:"id,omitzero"`
	Subject Nullable[string] `json:"subject,omitzero"`
	Folder  *string          `json:"folder,omitzero"`
	Labels  []InboxLabelRef  `json:"labels,omitzero"`
	// Read: True only when every message in the thread is read
	Read *bool `json:"read,omitzero"`
	// ReceivedAt: When the thread was last active. Not in Resend's thread object.
	ReceivedAt *string `json:"received_at,omitzero"`
	// DeleteAfter: When a thread in trash is removed. Not in Resend.
	DeleteAfter Nullable[string] `json:"delete_after,omitzero"`
}

type InboxThreadEmail

type InboxThreadEmail struct {
	// ID: For a received message, also its id under /v1/emails/receiving
	ID          *string                           `json:"id,omitzero"`
	Direction   *string                           `json:"direction,omitzero"`
	From        *string                           `json:"from,omitzero"`
	To          []string                          `json:"to,omitzero"`
	Cc          []string                          `json:"cc,omitzero"`
	Bcc         []string                          `json:"bcc,omitzero"`
	ReplyTo     []string                          `json:"reply_to,omitzero"`
	Subject     Nullable[string]                  `json:"subject,omitzero"`
	MessageID   Nullable[string]                  `json:"message_id,omitzero"`
	HTML        Nullable[string]                  `json:"html,omitzero"`
	Text        Nullable[string]                  `json:"text,omitzero"`
	Attachments []InboxThreadEmailAttachmentsItem `json:"attachments,omitzero"`
	Read        *bool                             `json:"read,omitzero"`
	ReceivedAt  *string                           `json:"received_at,omitzero"`
	// Status: delivered or quarantined for a received message, the send status for a sent one. Not in Resend.
	Status *string `json:"status,omitzero"`
	// Verdicts: SES authentication and scan verdicts of a received message (null for sent ones). Not in Resend.
	Verdicts Nullable[InboxThreadEmailVerdicts] `json:"verdicts,omitzero"`
	// InReplyTo: Not in Resend
	InReplyTo Nullable[string] `json:"in_reply_to,omitzero"`
}

type InboxThreadEmailAttachmentsItem

type InboxThreadEmailAttachmentsItem struct {
	ID          *string          `json:"id,omitzero"`
	Filename    Nullable[string] `json:"filename,omitzero"`
	Size        Nullable[int64]  `json:"size,omitzero"`
	ContentType Nullable[string] `json:"content_type,omitzero"`
}

type InboxThreadEmailVerdicts

type InboxThreadEmailVerdicts struct {
	SPF   Nullable[string] `json:"spf,omitzero"`
	DKIM  Nullable[string] `json:"dkim,omitzero"`
	DMARC Nullable[string] `json:"dmarc,omitzero"`
	Spam  Nullable[string] `json:"spam,omitzero"`
	Virus Nullable[string] `json:"virus,omitzero"`
}

InboxThreadEmailVerdicts: SES authentication and scan verdicts of a received message (null for sent ones). Not in Resend.

type InboxThreadListItem

type InboxThreadListItem struct {
	ID      *string          `json:"id,omitzero"`
	Subject Nullable[string] `json:"subject,omitzero"`
	// From: Sender of the most recent message
	From          Nullable[string] `json:"from,omitzero"`
	To            []string         `json:"to,omitzero"`
	Cc            []string         `json:"cc,omitzero"`
	Bcc           []string         `json:"bcc,omitzero"`
	Labels        []InboxLabelRef  `json:"labels,omitzero"`
	MessageCount  *int64           `json:"message_count,omitzero"`
	HasAttachment *bool            `json:"has_attachment,omitzero"`
	HasDraft      *bool            `json:"has_draft,omitzero"`
	Read          *bool            `json:"read,omitzero"`
	ReceivedAt    *string          `json:"received_at,omitzero"`
	// Folder: Not in Resend's list item
	Folder *string `json:"folder,omitzero"`
	// UnreadCount: Unread messages in the thread. Not in Resend.
	UnreadCount *int64 `json:"unread_count,omitzero"`
	// Snippet: A preview of the most recent message. Not in Resend.
	Snippet Nullable[string] `json:"snippet,omitzero"`
}

type InboxesDraftsService

type InboxesDraftsService struct {
	// contains filtered or unexported fields
}

InboxesDraftsService groups the inboxes.drafts operations.

func (*InboxesDraftsService) Create

func (s *InboxesDraftsService) Create(ctx context.Context, inboxID string, params *CreateInboxDraftParams, opts ...RequestOption) (*InboxDraft, error)

Create: Create a draft (POST /v1/inboxes/{inbox_id}/drafts).

func (*InboxesDraftsService) Delete

func (s *InboxesDraftsService) Delete(ctx context.Context, inboxID string, draftID string, opts ...RequestOption) (*DeleteInboxDraftResponse, error)

Delete: Delete a draft (DELETE /v1/inboxes/{inbox_id}/drafts/{draft_id}).

func (*InboxesDraftsService) Get

func (s *InboxesDraftsService) Get(ctx context.Context, inboxID string, draftID string, opts ...RequestOption) (*InboxDraft, error)

Get: Retrieve a draft (GET /v1/inboxes/{inbox_id}/drafts/{draft_id}).

func (*InboxesDraftsService) List

List: List drafts (GET /v1/inboxes/{inbox_id}/drafts).

func (*InboxesDraftsService) ListAll

ListAll iterates over every item of List, fetching the following pages as needed.

func (*InboxesDraftsService) Send

Send: Send a draft (POST /v1/inboxes/{inbox_id}/drafts/{draft_id}/send).

func (*InboxesDraftsService) Update

func (s *InboxesDraftsService) Update(ctx context.Context, inboxID string, draftID string, params *UpdateInboxDraftParams, opts ...RequestOption) (*InboxDraft, error)

Update: Update a draft (PATCH /v1/inboxes/{inbox_id}/drafts/{draft_id}).

type InboxesLabelsService

type InboxesLabelsService struct {
	// contains filtered or unexported fields
}

InboxesLabelsService groups the inboxes.labels operations.

func (*InboxesLabelsService) Create

func (s *InboxesLabelsService) Create(ctx context.Context, inboxID string, params *CreateInboxLabelParams, opts ...RequestOption) (*InboxLabel, error)

Create: Create a label (POST /v1/inboxes/{inbox_id}/labels).

func (*InboxesLabelsService) Delete

func (s *InboxesLabelsService) Delete(ctx context.Context, inboxID string, labelID string, opts ...RequestOption) (*DeleteInboxLabelResponse, error)

Delete: Delete a label (DELETE /v1/inboxes/{inbox_id}/labels/{label_id}).

func (*InboxesLabelsService) Get

func (s *InboxesLabelsService) Get(ctx context.Context, inboxID string, labelID string, opts ...RequestOption) (*InboxLabel, error)

Get: Retrieve a label (GET /v1/inboxes/{inbox_id}/labels/{label_id}).

func (*InboxesLabelsService) List

List: List labels (GET /v1/inboxes/{inbox_id}/labels).

func (*InboxesLabelsService) Update

Update: Update a label (PATCH /v1/inboxes/{inbox_id}/labels/{label_id}).

type InboxesService

type InboxesService struct {
	Threads *InboxesThreadsService
	Labels  *InboxesLabelsService
	Drafts  *InboxesDraftsService
	// contains filtered or unexported fields
}

InboxesService groups the inboxes operations.

func (*InboxesService) Create

func (s *InboxesService) Create(ctx context.Context, params *CreateInboxParams, opts ...RequestOption) (*Inbox, error)

Create: Create an inbox (POST /v1/inboxes).

func (*InboxesService) Delete

func (s *InboxesService) Delete(ctx context.Context, inboxID string, opts ...RequestOption) (*DeleteInboxResponse, error)

Delete: Delete an inbox (DELETE /v1/inboxes/{inbox_id}).

func (*InboxesService) Get

func (s *InboxesService) Get(ctx context.Context, inboxID string, opts ...RequestOption) (*Inbox, error)

Get: Retrieve an inbox (GET /v1/inboxes/{inbox_id}).

func (*InboxesService) List

List: List inboxes (GET /v1/inboxes).

func (*InboxesService) ListAll

ListAll iterates over every item of List, fetching the following pages as needed.

func (*InboxesService) Update

func (s *InboxesService) Update(ctx context.Context, inboxID string, params *UpdateInboxParams, opts ...RequestOption) (*UpdateInboxResponse, error)

Update: Update an inbox (PATCH /v1/inboxes/{inbox_id}).

type InboxesThreadsEmailsService

type InboxesThreadsEmailsService struct {
	// contains filtered or unexported fields
}

InboxesThreadsEmailsService groups the inboxes.threads.emails operations.

func (*InboxesThreadsEmailsService) Forward

func (s *InboxesThreadsEmailsService) Forward(ctx context.Context, inboxID string, threadID string, emailID string, params *ForwardInboxThreadEmailParams, opts ...RequestOption) (*InboxSentEmail, error)

Forward: Forward a thread email (POST /v1/inboxes/{inbox_id}/threads/{thread_id}/emails/{email_id}/forward).

func (*InboxesThreadsEmailsService) Get

func (s *InboxesThreadsEmailsService) Get(ctx context.Context, inboxID string, threadID string, emailID string, opts ...RequestOption) (*InboxThreadEmail, error)

Get: Retrieve a thread email (GET /v1/inboxes/{inbox_id}/threads/{thread_id}/emails/{email_id}).

func (*InboxesThreadsEmailsService) List

List: List thread emails (GET /v1/inboxes/{inbox_id}/threads/{thread_id}/emails).

func (*InboxesThreadsEmailsService) ListAll

ListAll iterates over every item of List, fetching the following pages as needed.

func (*InboxesThreadsEmailsService) Reply

func (s *InboxesThreadsEmailsService) Reply(ctx context.Context, inboxID string, threadID string, emailID string, params *ReplyToInboxThreadEmailParams, opts ...RequestOption) (*InboxSentEmail, error)

Reply: Reply to a thread email (POST /v1/inboxes/{inbox_id}/threads/{thread_id}/emails/{email_id}/reply).

type InboxesThreadsService

type InboxesThreadsService struct {
	Emails *InboxesThreadsEmailsService
	// contains filtered or unexported fields
}

InboxesThreadsService groups the inboxes.threads operations.

func (*InboxesThreadsService) Delete

func (s *InboxesThreadsService) Delete(ctx context.Context, inboxID string, threadID string, opts ...RequestOption) (*DeleteInboxThreadResponse, error)

Delete: Delete a thread (DELETE /v1/inboxes/{inbox_id}/threads/{thread_id}).

func (*InboxesThreadsService) Get

func (s *InboxesThreadsService) Get(ctx context.Context, inboxID string, threadID string, opts ...RequestOption) (*InboxThread, error)

Get: Retrieve a thread (GET /v1/inboxes/{inbox_id}/threads/{thread_id}).

func (*InboxesThreadsService) List

List: List threads (GET /v1/inboxes/{inbox_id}/threads).

func (*InboxesThreadsService) ListAll

ListAll iterates over every item of List, fetching the following pages as needed.

func (*InboxesThreadsService) Update

func (s *InboxesThreadsService) Update(ctx context.Context, inboxID string, threadID string, params *UpdateInboxThreadParams, opts ...RequestOption) (*InboxThread, error)

Update: Update a thread (PATCH /v1/inboxes/{inbox_id}/threads/{thread_id}).

type LinkDomain

type LinkDomain struct {
	Object   string `json:"object"`
	ID       string `json:"id"`
	Hostname string `json:"hostname"`
	// DomainID: The sending domain the hostname sits under.
	DomainID *string `json:"domain_id"`
	Domain   *string `json:"domain"`
	// Status: pending until Cloudflare sees the CNAME record and issues the certificate, then active. failed means it will not become active without a change on you
	Status string `json:"status"`
	// SslStatus: The certificate status Cloudflare reports, for troubleshooting.
	SslStatus *string `json:"ssl_status"`
	// LastError: Why the link domain is not active yet, when Cloudflare says.
	LastError  *string               `json:"last_error"`
	DNSRecords []LinkDomainDNSRecord `json:"dns_records"`
	// VerifiedAt: When it first became active.
	VerifiedAt    *string `json:"verified_at"`
	LastCheckedAt *string `json:"last_checked_at"`
	CreatedAt     string  `json:"created_at"`
}

LinkDomain: A custom hostname for open tracking, click tracking and unsubscribe links. While it is active, email whose From address is on the same registrable dom

type LinkDomainConnectCheck

type LinkDomainConnectCheck struct {
	// Available: Whether the DNS provider can add the CNAME record in one click through Domain Connect.
	Available bool `json:"available"`
	// Provider: The DNS provider, when discovery found one.
	Provider *string `json:"provider"`
	// Reason: Why one-click setup is not available, when it is not.
	Reason *string `json:"reason"`
}
type LinkDomainConnectLink struct {
	// URL: The signed link to open. The DNS provider shows the CNAME record and asks the domain owner to approve it.
	URL      string `json:"url"`
	Provider string `json:"provider"`
}

type LinkDomainDNSRecord

type LinkDomainDNSRecord struct {
	Type    string `json:"type"`
	Name    string `json:"name"`
	Value   string `json:"value"`
	Ttl     string `json:"ttl"`
	Purpose string `json:"purpose"`
	// Required: The CNAME is required. A TXT record Cloudflare offers is optional: it lets the hostname activate before the CNAME is live.
	Required bool `json:"required"`
	// Status: pending while the link domain is not active. Once it is active the CNAME is verified (keep it: certificate renewals need it) and a TXT record is not_n
	Status string `json:"status"`
}

type LinkDomainDeleted

type LinkDomainDeleted struct {
	Object  string `json:"object"`
	ID      string `json:"id"`
	Deleted bool   `json:"deleted"`
}

type LinkDomainError

type LinkDomainError struct {
	Error string  `json:"error"`
	Code  *string `json:"code,omitzero"`
}

type LinkDomainList

type LinkDomainList struct {
	Object  string       `json:"object"`
	HasMore bool         `json:"has_more"`
	Data    []LinkDomain `json:"data"`
	// Available: Whether custom link domains are available on this server. When false, creating one answers 503.
	Available bool `json:"available"`
	// IncludedInPlan: Whether the team's plan includes custom link domains (every paid plan). When false, creating one answers 403 and mail uses smtpfa.st links, also throu
	IncludedInPlan bool `json:"included_in_plan"`
}

type LinkDomainsService

type LinkDomainsService struct {
	// contains filtered or unexported fields
}

LinkDomainsService groups the linkDomains operations.

func (*LinkDomainsService) Create

Create: Add a link domain (POST /v1/link-domains).

func (*LinkDomainsService) Delete

Delete: Delete a link domain (DELETE /v1/link-domains/{id}).

func (*LinkDomainsService) Get

func (s *LinkDomainsService) Get(ctx context.Context, id string, opts ...RequestOption) (*LinkDomain, error)

Get: Get a link domain (GET /v1/link-domains/{id}).

func (*LinkDomainsService) GetDomainConnect

func (s *LinkDomainsService) GetDomainConnect(ctx context.Context, id string, opts ...RequestOption) (*LinkDomainConnectCheck, error)

GetDomainConnect: Check one-click DNS setup for a link domain (GET /v1/link-domains/{id}/domain-connect).

func (*LinkDomainsService) List

List: List link domains (GET /v1/link-domains).

func (*LinkDomainsService) Refresh

func (s *LinkDomainsService) Refresh(ctx context.Context, id string, opts ...RequestOption) (*LinkDomain, error)

Refresh: Refresh a link domain's status (POST /v1/link-domains/{id}/refresh).

func (*LinkDomainsService) StartDomainConnect

func (s *LinkDomainsService) StartDomainConnect(ctx context.Context, id string, opts ...RequestOption) (*LinkDomainConnectLink, error)

StartDomainConnect: Set up a link domain's DNS in one click (POST /v1/link-domains/{id}/domain-connect).

type ListAPIKeysResponse

type ListAPIKeysResponse struct {
	Object  string   `json:"object"`
	HasMore bool     `json:"has_more"`
	Data    []APIKey `json:"data"`
}

type ListBroadcastClickedLinksResponse

type ListBroadcastClickedLinksResponse struct {
	BroadcastID string                                       `json:"broadcast_id"`
	Links       []ListBroadcastClickedLinksResponseLinksItem `json:"links"`
	TotalClicks int64                                        `json:"total_clicks"`
}

type ListBroadcastClickedLinksResponseLinksItem

type ListBroadcastClickedLinksResponseLinksItem struct {
	URL    string `json:"url"`
	Clicks int64  `json:"clicks"`
	// UniqueClicks: Distinct recipients who clicked
	UniqueClicks int64 `json:"unique_clicks"`
}

type ListBroadcastRecipientsQuery

type ListBroadcastRecipientsQuery struct {
	Type       *string `json:"type,omitzero"`
	BounceType *string `json:"bounce_type,omitzero"`
	Email      *string `json:"email,omitzero"`
	Limit      *int64  `json:"limit,omitzero"`
	After      *string `json:"after,omitzero"`
	Before     *string `json:"before,omitzero"`
}

type ListBroadcastsQuery

type ListBroadcastsQuery struct {
	Status   *string `json:"status,omitzero"`
	Q        *string `json:"q,omitzero"`
	Archived *string `json:"archived,omitzero"`
}

type ListClickedLinksQuery

type ListClickedLinksQuery struct {
	Days     *int64  `json:"days,omitzero"`
	DomainID *string `json:"domain_id,omitzero"`
	URL      *string `json:"url,omitzero"`
}

type ListContactPropertiesResponse

type ListContactPropertiesResponse struct {
	Object  string            `json:"object"`
	HasMore bool              `json:"has_more"`
	Data    []ContactProperty `json:"data"`
}

type ListContactsQuery

type ListContactsQuery struct {
	Q          *string `json:"q,omitzero"`
	Status     *string `json:"status,omitzero"`
	Disposable *bool   `json:"disposable,omitzero"`
	SegmentID  *string `json:"segment_id,omitzero"`
	Limit      *int64  `json:"limit,omitzero"`
	Page       *int64  `json:"page,omitzero"`
}

type ListDomainsResponse

type ListDomainsResponse struct {
	Object  string           `json:"object"`
	HasMore bool             `json:"has_more"`
	Data    []DomainListItem `json:"data"`
}

type ListEmailsQuery

type ListEmailsQuery struct {
	Limit  *int64  `json:"limit,omitzero"`
	Page   *int64  `json:"page,omitzero"`
	Status *string `json:"status,omitzero"`
	To     *string `json:"to,omitzero"`
	After  *string `json:"after,omitzero"`
	Before *string `json:"before,omitzero"`
}

type ListInboxDraftsQuery

type ListInboxDraftsQuery struct {
	Limit  *int64  `json:"limit,omitzero"`
	After  *string `json:"after,omitzero"`
	Before *string `json:"before,omitzero"`
}

type ListInboxDraftsResponse

type ListInboxDraftsResponse struct {
	Object  *string              `json:"object,omitzero"`
	HasMore *bool                `json:"has_more,omitzero"`
	Data    []InboxDraftListItem `json:"data,omitzero"`
}

type ListInboxLabelsResponse

type ListInboxLabelsResponse struct {
	Object  *string      `json:"object,omitzero"`
	HasMore *bool        `json:"has_more,omitzero"`
	Data    []InboxLabel `json:"data,omitzero"`
}

type ListInboxThreadEmailsQuery

type ListInboxThreadEmailsQuery struct {
	Latest *bool   `json:"latest,omitzero"`
	Limit  *int64  `json:"limit,omitzero"`
	After  *string `json:"after,omitzero"`
	Before *string `json:"before,omitzero"`
}

type ListInboxThreadEmailsResponse

type ListInboxThreadEmailsResponse struct {
	Object  *string            `json:"object,omitzero"`
	HasMore *bool              `json:"has_more,omitzero"`
	Data    []InboxThreadEmail `json:"data,omitzero"`
}

type ListInboxThreadsQuery

type ListInboxThreadsQuery struct {
	Folder *string  `json:"folder,omitzero"`
	Query  *string  `json:"query,omitzero"`
	Label  []string `json:"label,omitzero"`
	Limit  *int64   `json:"limit,omitzero"`
	After  *string  `json:"after,omitzero"`
	Before *string  `json:"before,omitzero"`
}

type ListInboxThreadsResponse

type ListInboxThreadsResponse struct {
	Object  *string               `json:"object,omitzero"`
	HasMore *bool                 `json:"has_more,omitzero"`
	Data    []InboxThreadListItem `json:"data,omitzero"`
}

type ListInboxesQuery

type ListInboxesQuery struct {
	Limit  *int64  `json:"limit,omitzero"`
	After  *string `json:"after,omitzero"`
	Before *string `json:"before,omitzero"`
}

type ListInboxesResponse

type ListInboxesResponse struct {
	Object  *string         `json:"object,omitzero"`
	HasMore *bool           `json:"has_more,omitzero"`
	Data    []InboxListItem `json:"data,omitzero"`
}

type ListLogsQuery

type ListLogsQuery struct {
	Limit     *int64  `json:"limit,omitzero"`
	After     *string `json:"after,omitzero"`
	Before    *string `json:"before,omitzero"`
	Type      *string `json:"type,omitzero"`
	Since     *string `json:"since,omitzero"`
	Until     *string `json:"until,omitzero"`
	Recipient *string `json:"recipient,omitzero"`
	Domain    *string `json:"domain,omitzero"`
	DomainID  *string `json:"domain_id,omitzero"`
	Tag       *string `json:"tag,omitzero"`
	EmailID   *string `json:"email_id,omitzero"`
}

type ListLogsResponse

type ListLogsResponse struct {
	Object  *string    `json:"object,omitzero"`
	HasMore *bool      `json:"has_more,omitzero"`
	Data    []LogEvent `json:"data,omitzero"`
}

type ListPendingSignupsQuery

type ListPendingSignupsQuery struct {
	Page    *int64  `json:"page,omitzero"`
	PerPage *int64  `json:"per_page,omitzero"`
	Q       *string `json:"q,omitzero"`
}

type ListReceivedEmailAttachmentsResponse

type ListReceivedEmailAttachmentsResponse struct {
	Object *string              `json:"object,omitzero"`
	Data   []ReceivedAttachment `json:"data,omitzero"`
}

type ListReceivedEmailsQuery

type ListReceivedEmailsQuery struct {
	Limit    *int64  `json:"limit,omitzero"`
	After    *string `json:"after,omitzero"`
	Before   *string `json:"before,omitzero"`
	To       *string `json:"to,omitzero"`
	DomainID *string `json:"domain_id,omitzero"`
	Unread   *bool   `json:"unread,omitzero"`
	Q        *string `json:"q,omitzero"`
}

type ListReceivedEmailsResponse

type ListReceivedEmailsResponse struct {
	Object  *string                `json:"object,omitzero"`
	HasMore *bool                  `json:"has_more,omitzero"`
	Data    []ReceivedEmailSummary `json:"data,omitzero"`
	// UnreadCount: Unread emails matching the same to, domain_id and q filters (not in Resend)
	UnreadCount *int64 `json:"unread_count,omitzero"`
}

type ListSegmentContactsQuery

type ListSegmentContactsQuery struct {
	Limit *int64 `json:"limit,omitzero"`
	Page  *int64 `json:"page,omitzero"`
}

type ListSuppressionsQuery

type ListSuppressionsQuery struct {
	Q      *string `json:"q,omitzero"`
	Reason *string `json:"reason,omitzero"`
	Limit  *int64  `json:"limit,omitzero"`
}

type ListTeamInvitesResponse

type ListTeamInvitesResponse struct {
	Object  string       `json:"object"`
	HasMore bool         `json:"has_more"`
	Data    []TeamInvite `json:"data"`
}

type ListTeamMembersResponse

type ListTeamMembersResponse struct {
	Object  string       `json:"object"`
	HasMore bool         `json:"has_more"`
	Data    []TeamMember `json:"data"`
}

type ListTemplatesQuery

type ListTemplatesQuery struct {
	Limit  *int64  `json:"limit,omitzero"`
	After  *string `json:"after,omitzero"`
	Before *string `json:"before,omitzero"`
	Q      *string `json:"q,omitzero"`
}

type ListWebhookDeliveriesQuery

type ListWebhookDeliveriesQuery struct {
	Status *string `json:"status,omitzero"`
	Limit  *int64  `json:"limit,omitzero"`
	After  *string `json:"after,omitzero"`
}

type ListWebhookDeliveriesResponse

type ListWebhookDeliveriesResponse struct {
	Object  *string           `json:"object,omitzero"`
	HasMore *bool             `json:"has_more,omitzero"`
	Data    []WebhookDelivery `json:"data,omitzero"`
}

type ListWebhookEventAttemptsResponse

type ListWebhookEventAttemptsResponse struct {
	Object  *string                                    `json:"object,omitzero"`
	HasMore *bool                                      `json:"has_more,omitzero"`
	Data    []ListWebhookEventAttemptsResponseDataItem `json:"data,omitzero"`
}

type ListWebhookEventAttemptsResponseDataItem

type ListWebhookEventAttemptsResponseDataItem struct {
	ID             *string          `json:"id,omitzero"`
	HTTPStatusCode Nullable[int64]  `json:"http_status_code,omitzero"`
	Response       Nullable[string] `json:"response,omitzero"`
	SentAt         Nullable[string] `json:"sent_at,omitzero"`
	DurationMs     Nullable[int64]  `json:"duration_ms,omitzero"`
}

type ListWebhookEventsQuery

type ListWebhookEventsQuery struct {
	Limit  *int64  `json:"limit,omitzero"`
	After  *string `json:"after,omitzero"`
	Status *string `json:"status,omitzero"`
}

type ListWebhookEventsResponse

type ListWebhookEventsResponse struct {
	Object  *string               `json:"object,omitzero"`
	HasMore *bool                 `json:"has_more,omitzero"`
	Data    []WebhookEventSummary `json:"data,omitzero"`
}

type ListWebhooksResponse

type ListWebhooksResponse struct {
	Object  string    `json:"object"`
	HasMore bool      `json:"has_more"`
	Data    []Webhook `json:"data"`
}

type LogEvent

type LogEvent struct {
	Object    *string            `json:"object,omitzero"`
	ID        *string            `json:"id,omitzero"`
	Type      *string            `json:"type,omitzero"`
	CreatedAt *string            `json:"created_at,omitzero"`
	EmailID   *string            `json:"email_id,omitzero"`
	From      *string            `json:"from,omitzero"`
	To        []string           `json:"to,omitzero"`
	Subject   *string            `json:"subject,omitzero"`
	DomainID  Nullable[string]   `json:"domain_id,omitzero"`
	Tags      []LogEventTagsItem `json:"tags,omitzero"`
	// Data: Event details: bounce type, clicked URL, error message, and similar
	Data map[string]any `json:"data,omitzero"`
}

type LogEventTagsItem

type LogEventTagsItem struct {
	Name  *string `json:"name,omitzero"`
	Value *string `json:"value,omitzero"`
}

type LogsService

type LogsService struct {
	// contains filtered or unexported fields
}

LogsService groups the logs operations.

func (*LogsService) List

func (s *LogsService) List(ctx context.Context, query *ListLogsQuery, opts ...RequestOption) (*ListLogsResponse, error)

List: List email events (GET /v1/logs).

func (*LogsService) ListAll

func (s *LogsService) ListAll(ctx context.Context, query *ListLogsQuery, opts ...RequestOption) iter.Seq2[LogEvent, error]

ListAll iterates over every item of List, fetching the following pages as needed.

type MarkReceivedEmailsParams

type MarkReceivedEmailsParams struct {
	IDs  []string `json:"ids"`
	Read bool     `json:"read"`
}

type MarkReceivedEmailsResponse

type MarkReceivedEmailsResponse struct {
	Object  *string `json:"object,omitzero"`
	Read    *bool   `json:"read,omitzero"`
	Updated *int64  `json:"updated,omitzero"`
}

type Nullable

type Nullable[T any] struct {
	Value T
	// Valid is false for null.
	Valid bool
	// Set is false when the field is left out (or was absent in a response).
	Set bool
}

Nullable is a field that can be left out, set to null, or set to a value. A request leaves it out by default; Null clears the field, Value sets it.

func Null

func Null[T any]() Nullable[T]

Null returns a Nullable that sends null, which clears the field.

func Value

func Value[T any](v T) Nullable[T]

Value returns a Nullable that sends v.

func (Nullable[T]) IsZero

func (n Nullable[T]) IsZero() bool

IsZero reports whether the field is left out, for the omitzero tag.

func (Nullable[T]) MarshalJSON

func (n Nullable[T]) MarshalJSON() ([]byte, error)

MarshalJSON writes null or the value.

func (*Nullable[T]) UnmarshalJSON

func (n *Nullable[T]) UnmarshalJSON(b []byte) error

UnmarshalJSON reads null or a value.

type Option

type Option func(*core)

Option configures a Client.

func WithAPIKey

func WithAPIKey(key string) Option

WithAPIKey sets the API key. The default is the SMTPFAST_API_KEY environment variable.

func WithBaseURL

func WithBaseURL(u string) Option

WithBaseURL sets the API base URL. The default is https://smtpfa.st/api.

func WithHTTPClient

func WithHTTPClient(h *http.Client) Option

WithHTTPClient sets the http.Client used for requests.

func WithMaxRetries

func WithMaxRetries(n int) Option

WithMaxRetries sets how many times a failed request is retried. The default is 2.

func WithTimeout

func WithTimeout(d time.Duration) Option

WithTimeout sets the time limit for each attempt. The default is 60 seconds.

type PendingSignup

type PendingSignup struct {
	ID        string  `json:"id"`
	Email     string  `json:"email"`
	FirstName *string `json:"first_name"`
	LastName  *string `json:"last_name"`
	CreatedAt string  `json:"created_at"`
	ExpiresAt string  `json:"expires_at"`
	// Country: Two-letter country code, or T1 when the signup came through Tor. The IP address is not stored.
	Country *string `json:"country"`
	// SourceURL: The page the form was submitted on: address plus utm_* parameters only.
	SourceURL *string `json:"source_url"`
	// ConfirmationEmail: The confirmation email and its current status. Null when no email was queued for this signup, or for signups recorded before this was tracked.
	ConfirmationEmail *PendingSignupConfirmationEmail `json:"confirmation_email"`
}

type PendingSignupConfirmationEmail

type PendingSignupConfirmationEmail struct {
	ID     *string `json:"id,omitzero"`
	Status *string `json:"status,omitzero"`
}

PendingSignupConfirmationEmail: The confirmation email and its current status. Null when no email was queued for this signup, or for signups recorded before this was tracked.

type PendingSignupList

type PendingSignupList struct {
	Object  string          `json:"object"`
	HasMore bool            `json:"has_more"`
	Data    []PendingSignup `json:"data"`
	Total   int64           `json:"total"`
	// UndeliverableTotal: How many of the matching signups have an undeliverable confirmation email. Approve all leaves these out.
	UndeliverableTotal int64 `json:"undeliverable_total"`
	// TorTotal: How many of the matching signups were submitted through Tor. Approve all leaves these out.
	TorTotal int64 `json:"tor_total"`
	// ApprovableTotal: How many of the matching signups Approve all would confirm.
	ApprovableTotal int64 `json:"approvable_total"`
	Page            int64 `json:"page"`
	PerPage         int64 `json:"per_page"`
}

type PreviewFormWelcomeEmailParams

type PreviewFormWelcomeEmailParams struct {
	Subject  *string                              `json:"subject,omitzero"`
	Markdown *string                              `json:"markdown,omitzero"`
	Sample   *PreviewFormWelcomeEmailParamsSample `json:"sample,omitzero"`
}

type PreviewFormWelcomeEmailParamsSample

type PreviewFormWelcomeEmailParamsSample struct {
	Email     *string `json:"email,omitzero"`
	FirstName *string `json:"firstName,omitzero"`
	LastName  *string `json:"lastName,omitzero"`
}

type PublishTemplateParams

type PublishTemplateParams struct {
	// ExpectedUpdatedAt: Not in Resend. The updated_at you loaded.
	ExpectedUpdatedAt *string `json:"expected_updated_at,omitzero"`
}

type ReceivedAttachment

type ReceivedAttachment struct {
	ID                 *string          `json:"id,omitzero"`
	Filename           *string          `json:"filename,omitzero"`
	ContentType        *string          `json:"content_type,omitzero"`
	ContentDisposition *string          `json:"content_disposition,omitzero"`
	ContentID          Nullable[string] `json:"content_id,omitzero"`
	Size               *int64           `json:"size,omitzero"`
	// DownloadURL: Present on the attachment endpoints; valid for 15 minutes
	DownloadURL *string `json:"download_url,omitzero"`
	ExpiresAt   *string `json:"expires_at,omitzero"`
}

type ReceivedEmail

type ReceivedEmail struct {
	Object       *string                `json:"object,omitzero"`
	ID           *string                `json:"id,omitzero"`
	To           []string               `json:"to,omitzero"`
	From         *string                `json:"from,omitzero"`
	CreatedAt    *string                `json:"created_at,omitzero"`
	Subject      *string                `json:"subject,omitzero"`
	Bcc          []string               `json:"bcc,omitzero"`
	Cc           []string               `json:"cc,omitzero"`
	ReplyTo      []string               `json:"reply_to,omitzero"`
	ReceivedFor  []string               `json:"received_for,omitzero"`
	MessageID    *string                `json:"message_id,omitzero"`
	Attachments  []ReceivedAttachment   `json:"attachments,omitzero"`
	Status       *string                `json:"status,omitzero"`
	EnvelopeFrom Nullable[string]       `json:"envelope_from,omitzero"`
	EnvelopeTo   []string               `json:"envelope_to,omitzero"`
	DomainID     Nullable[string]       `json:"domain_id,omitzero"`
	Size         Nullable[int64]        `json:"size,omitzero"`
	Verdicts     *ReceivedEmailVerdicts `json:"verdicts,omitzero"`
	InReplyTo    Nullable[string]       `json:"in_reply_to,omitzero"`
	References   []string               `json:"references,omitzero"`
	// ReadAt: When the message was marked read. Not in Resend.
	ReadAt Nullable[string] `json:"read_at,omitzero"`
	// InboxID: The inbox this copy was filed into, when its address has one. Not in Resend.
	InboxID Nullable[string] `json:"inbox_id,omitzero"`
	// ThreadID: The inbox thread this copy was filed into. Not in Resend.
	ThreadID Nullable[string]           `json:"thread_id,omitzero"`
	HTML     Nullable[string]           `json:"html,omitzero"`
	Text     Nullable[string]           `json:"text,omitzero"`
	Headers  map[string]string          `json:"headers,omitzero"`
	Raw      Nullable[ReceivedEmailRaw] `json:"raw,omitzero"`
}

type ReceivedEmailRaw

type ReceivedEmailRaw struct {
	DownloadURL *string `json:"download_url,omitzero"`
	ExpiresAt   *string `json:"expires_at,omitzero"`
}

type ReceivedEmailSummary

type ReceivedEmailSummary struct {
	Object       *string                       `json:"object,omitzero"`
	ID           *string                       `json:"id,omitzero"`
	To           []string                      `json:"to,omitzero"`
	From         *string                       `json:"from,omitzero"`
	CreatedAt    *string                       `json:"created_at,omitzero"`
	Subject      *string                       `json:"subject,omitzero"`
	Bcc          []string                      `json:"bcc,omitzero"`
	Cc           []string                      `json:"cc,omitzero"`
	ReplyTo      []string                      `json:"reply_to,omitzero"`
	ReceivedFor  []string                      `json:"received_for,omitzero"`
	MessageID    *string                       `json:"message_id,omitzero"`
	Attachments  []ReceivedAttachment          `json:"attachments,omitzero"`
	Status       *string                       `json:"status,omitzero"`
	EnvelopeFrom Nullable[string]              `json:"envelope_from,omitzero"`
	EnvelopeTo   []string                      `json:"envelope_to,omitzero"`
	DomainID     Nullable[string]              `json:"domain_id,omitzero"`
	Size         Nullable[int64]               `json:"size,omitzero"`
	Verdicts     *ReceivedEmailSummaryVerdicts `json:"verdicts,omitzero"`
	InReplyTo    Nullable[string]              `json:"in_reply_to,omitzero"`
	References   []string                      `json:"references,omitzero"`
	// ReadAt: When the message was marked read. Not in Resend.
	ReadAt Nullable[string] `json:"read_at,omitzero"`
	// InboxID: The inbox this copy was filed into, when its address has one. Not in Resend.
	InboxID Nullable[string] `json:"inbox_id,omitzero"`
	// ThreadID: The inbox thread this copy was filed into. Not in Resend.
	ThreadID Nullable[string] `json:"thread_id,omitzero"`
}

type ReceivedEmailSummaryVerdicts

type ReceivedEmailSummaryVerdicts struct {
	SPF   Nullable[string] `json:"spf,omitzero"`
	DKIM  Nullable[string] `json:"dkim,omitzero"`
	DMARC Nullable[string] `json:"dmarc,omitzero"`
	Spam  Nullable[string] `json:"spam,omitzero"`
	Virus Nullable[string] `json:"virus,omitzero"`
}

type ReceivedEmailVerdicts

type ReceivedEmailVerdicts struct {
	SPF   Nullable[string] `json:"spf,omitzero"`
	DKIM  Nullable[string] `json:"dkim,omitzero"`
	DMARC Nullable[string] `json:"dmarc,omitzero"`
	Spam  Nullable[string] `json:"spam,omitzero"`
	Virus Nullable[string] `json:"virus,omitzero"`
}

type RemovePendingSignupResponse

type RemovePendingSignupResponse struct {
	Deleted bool `json:"deleted"`
}

type RemoveSuppressionsBatchParams

type RemoveSuppressionsBatchParams struct {
	Emails []string `json:"emails,omitzero"`
	IDs    []string `json:"ids,omitzero"`
}

type ReplayWebhookEventResponse

type ReplayWebhookEventResponse struct {
	Object    *string `json:"object,omitzero"`
	ID        *string `json:"id,omitzero"`
	Delivered *bool   `json:"delivered,omitzero"`
	Error     *string `json:"error,omitzero"`
}

type ReplyToInboxThreadEmailParams

type ReplyToInboxThreadEmailParams struct {
	Cc      StringList `json:"cc,omitzero"`
	Bcc     StringList `json:"bcc,omitzero"`
	HTML    *string    `json:"html,omitzero"`
	Text    *string    `json:"text,omitzero"`
	Subject *string    `json:"subject,omitzero"`
}

type ReplyToReceivedEmailParams

type ReplyToReceivedEmailParams struct {
	// From: One of the team's reply addresses for this message; see the dashboard detail's reply_from
	From *string    `json:"from,omitzero"`
	To   StringList `json:"to,omitzero"`
	Cc   StringList `json:"cc,omitzero"`
	// Subject: Defaults to Re: plus the original subject
	Subject *string `json:"subject,omitzero"`
	Text    *string `json:"text,omitzero"`
	HTML    *string `json:"html,omitzero"`
}

type ReplyToReceivedEmailResponse

type ReplyToReceivedEmailResponse struct {
	ID *string `json:"id,omitzero"`
}

type RequestOption

type RequestOption func(*requestSettings)

RequestOption changes one call.

func WithHeader

func WithHeader(key, value string) RequestOption

WithHeader adds a header to one call.

func WithIdempotencyKey

func WithIdempotencyKey(key string) RequestOption

WithIdempotencyKey sets the Idempotency-Key of a send, reply or forward. A retry with the same key and body returns the first answer instead of sending again. Without it, the SDK makes one per call when retries are on.

func WithRequestMaxRetries

func WithRequestMaxRetries(n int) RequestOption

WithRequestMaxRetries overrides the client's retry count for one call.

func WithRequestTimeout

func WithRequestTimeout(d time.Duration) RequestOption

WithRequestTimeout overrides the client's per-attempt timeout for one call.

type RetryWebhookDeliveryResponse

type RetryWebhookDeliveryResponse struct {
	Success  *bool            `json:"success,omitzero"`
	Message  *string          `json:"message,omitzero"`
	Delivery *WebhookDelivery `json:"delivery,omitzero"`
}

type RevokeAPIKeyResponse

type RevokeAPIKeyResponse struct {
	Success bool `json:"success"`
	// Message: "Connected app disconnected" for a connected app's key
	Message string `json:"message"`
}

type RotateWebhookSigningSecretResponse

type RotateWebhookSigningSecretResponse struct {
	Object        *string `json:"object,omitzero"`
	ID            *string `json:"id,omitzero"`
	SigningSecret *string `json:"signing_secret,omitzero"`
}

type Segment

type Segment struct {
	ID           string           `json:"id"`
	Name         string           `json:"name"`
	Description  Nullable[string] `json:"description,omitzero"`
	Color        Nullable[string] `json:"color,omitzero"`
	ContactCount *int64           `json:"contact_count,omitzero"`
	CreatedAt    *string          `json:"created_at,omitzero"`
	UpdatedAt    *string          `json:"updated_at,omitzero"`
	Object       *string          `json:"object,omitzero"`
}

type SegmentContactList

type SegmentContactList struct {
	Object   string                    `json:"object"`
	HasMore  bool                      `json:"has_more"`
	Data     []ContactListItem         `json:"data"`
	Segment  SegmentContactListSegment `json:"segment"`
	Page     int64                     `json:"page"`
	PageSize int64                     `json:"page_size"`
	// Total: Contacts in the segment
	Total int64 `json:"total"`
}

type SegmentContactListSegment

type SegmentContactListSegment struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type SegmentList

type SegmentList struct {
	Object string `json:"object"`
	// HasMore: Always false: every segment is in one page
	HasMore      bool             `json:"has_more"`
	Data         []SegmentSummary `json:"data"`
	Total        int64            `json:"total"`
	SegmentLimit int64            `json:"segment_limit"`
	Tier         *string          `json:"tier,omitzero"`
}

type SegmentSummary

type SegmentSummary struct {
	ID           string           `json:"id"`
	Name         string           `json:"name"`
	Description  Nullable[string] `json:"description,omitzero"`
	Color        Nullable[string] `json:"color,omitzero"`
	ContactCount *int64           `json:"contact_count,omitzero"`
	CreatedAt    *string          `json:"created_at,omitzero"`
	UpdatedAt    *string          `json:"updated_at,omitzero"`
}

type SegmentsContactsService

type SegmentsContactsService struct {
	// contains filtered or unexported fields
}

SegmentsContactsService groups the segments.contacts operations.

func (*SegmentsContactsService) List

List: List contacts in a segment (GET /v1/segments/{id}/contacts).

type SegmentsService

type SegmentsService struct {
	Contacts *SegmentsContactsService
	// contains filtered or unexported fields
}

SegmentsService groups the segments operations.

func (*SegmentsService) Create

func (s *SegmentsService) Create(ctx context.Context, params *CreateSegmentRequest, opts ...RequestOption) (*Segment, error)

Create: Create a segment (POST /v1/segments).

func (*SegmentsService) Delete

func (s *SegmentsService) Delete(ctx context.Context, id string, opts ...RequestOption) (*DeletedObject, error)

Delete: Delete a segment (DELETE /v1/segments/{id}).

func (*SegmentsService) Get

func (s *SegmentsService) Get(ctx context.Context, id string, opts ...RequestOption) (*Segment, error)

Get: Retrieve a segment (GET /v1/segments/{id}).

func (*SegmentsService) List

func (s *SegmentsService) List(ctx context.Context, opts ...RequestOption) (*SegmentList, error)

List: List segments (GET /v1/segments).

func (*SegmentsService) Update

func (s *SegmentsService) Update(ctx context.Context, id string, params *UpdateSegmentRequest, opts ...RequestOption) (*Segment, error)

Update: Update a segment (PATCH /v1/segments/{id}).

type SendBroadcastParams

type SendBroadcastParams struct {
	ScheduledAt *string `json:"scheduled_at,omitzero"`
	// SendOverMinutes: Not in Resend. Spread the send evenly over this many minutes from the send time (or scheduled_at): recipient i of N goes out at start + i * window / N
	SendOverMinutes *int64 `json:"send_over_minutes,omitzero"`
}

type SendBroadcastTestParams

type SendBroadcastTestParams struct {
	To string `json:"to"`
}

type SendBroadcastTestResponse

type SendBroadcastTestResponse struct {
	Object string `json:"object"`
	// ID: The test email, in GET /v1/emails/{id}
	ID     string `json:"id"`
	Status string `json:"status"`
}

type SendEmailRequest

type SendEmailRequest struct {
	// Template: Send a published template instead of html and text, as in Resend. The published version is rendered with the variables, then every normal send rule ap
	Template *SendEmailRequestTemplate `json:"template,omitzero"`
	// Attachments: Up to 10 files, base64 encoded, 25 MB per message in total. A content_id makes the part inline: reference it from the HTML as cid:<content_id>.
	Attachments []SendEmailRequestAttachmentsItem `json:"attachments,omitzero"`
	// From: Sender email address (must belong to a verified domain)
	From *string `json:"from,omitzero"`
	// To: One recipient address, or a list of them
	To StringList `json:"to"`
	// Cc: Cc recipients
	Cc StringList `json:"cc,omitzero"`
	// Bcc: Bcc recipients
	Bcc StringList `json:"bcc,omitzero"`
	// ReplyTo: Reply-To address or addresses
	ReplyTo StringList `json:"reply_to,omitzero"`
	// Subject: Email subject line
	Subject *string `json:"subject,omitzero"`
	// Tags: Up to 50 name/value pairs, returned on events and webhooks and filterable in logs
	Tags []SendEmailRequestTagsItem `json:"tags,omitzero"`
	// Headers: Custom headers, e.g. X-Entity-Ref-ID
	Headers map[string]string `json:"headers,omitzero"`
	// ScheduledAt: Send later, up to 30 days ahead (ISO 8601)
	ScheduledAt *string `json:"scheduled_at,omitzero"`
	// Category: Defaults to marketing. Label receipts, password resets and other transactional mail transactional so a marketing opt-out does not block them; unlabell
	Category *string `json:"category,omitzero"`
	// TrackClicks: Not in Resend, which sets tracking per domain. Rewrite this email's links through the click tracker (true) or send them exactly as written (false). Le
	TrackClicks *bool `json:"track_clicks,omitzero"`
	// TrackOpens: Not in Resend. Add the open-tracking pixel to this email (true) or not (false). Left out, the account's tracking settings apply. Over SMTP, set the X-
	TrackOpens *bool `json:"track_opens,omitzero"`
	// HTML: HTML body of the email. Include `{{unsubscribe_url}}` (or the Resend-compatible `{{{RESEND_UNSUBSCRIBE_URL}}}`) anywhere in the body and SMTPfast subs
	HTML *string `json:"html,omitzero"`
	// Text: Plain text fallback body. Supports the same `{{unsubscribe_url}}` placeholder as the HTML body.
	Text *string `json:"text,omitzero"`
}

SendEmailRequest: from and subject are required, unless a template supplies them. Give a body as html and/or text, or name a published template; not both.

type SendEmailRequestAttachmentsItem

type SendEmailRequestAttachmentsItem struct {
	Filename string `json:"filename"`
	// Content: Base64-encoded file content
	Content     string  `json:"content"`
	ContentType *string `json:"content_type,omitzero"`
	// ContentID: Letters, digits, . _ - with an optional @domain; sent inline as multipart/related
	ContentID *string `json:"content_id,omitzero"`
	// Inline: Send inline even without a content_id (a Content-ID is derived from the filename)
	Inline *bool `json:"inline,omitzero"`
}

type SendEmailRequestTagsItem

type SendEmailRequestTagsItem struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type SendEmailRequestTemplate

type SendEmailRequestTemplate struct {
	// ID: The template id or alias.
	ID string `json:"id"`
	// Variables: Values by variable key. A missing value uses the inline fallback ({{{KEY|default}}}), then the variable's fallback_value. A declared variable with nei
	Variables map[string]any `json:"variables,omitzero"`
}

SendEmailRequestTemplate: Send a published template instead of html and text, as in Resend. The published version is rendered with the variables, then every normal send rule ap

type SendEmailResponse

type SendEmailResponse struct {
	ID string `json:"id"`
}

SendEmailResponse: The id of the accepted email, as Resend returns it. Fetch the email with GET /v1/emails/{id}.

type SendInboxDraftParams

type SendInboxDraftParams struct {
	// Revision: Send only if the draft is still at this revision, the one that was reviewed. Not in Resend.
	Revision *int64 `json:"revision,omitzero"`
}

type SendInboxDraftResponse

type SendInboxDraftResponse struct {
	Object   *string `json:"object,omitzero"`
	ID       *string `json:"id,omitzero"`
	ThreadID *string `json:"thread_id,omitzero"`
	EmailID  *string `json:"email_id,omitzero"`
	// SentRevision: Present with warning: the revision that went out. Not in Resend.
	SentRevision *int64 `json:"sent_revision,omitzero"`
	// Warning: Present when the email went out but the draft changed or was claimed again while the send ran, so it was not marked sent. Not in Resend.
	Warning *string `json:"warning,omitzero"`
}

type Service

type Service struct {
	Logs              *LogsService
	Emails            *EmailsService
	Inboxes           *InboxesService
	ContactProperties *ContactPropertiesService
	Contacts          *ContactsService
	Segments          *SegmentsService
	Account           *AccountService
	Team              *TeamService
	Suppressions      *SuppressionsService
	Broadcasts        *BroadcastsService
	Templates         *TemplatesService
	Domains           *DomainsService
	APIKeys           *APIKeysService
	Webhooks          *WebhooksService
	Forms             *FormsService
	LinkDomains       *LinkDomainsService
	Analytics         *AnalyticsService
	// contains filtered or unexported fields
}

Service groups the top-level operations.

type ShareEmailParams

type ShareEmailParams struct {
	// ExpiresIn: Lifetime in seconds (60 to 2592000)
	ExpiresIn *int64 `json:"expires_in,omitzero"`
}

type ShareEmailResponse

type ShareEmailResponse struct {
	Object    *string `json:"object,omitzero"`
	ID        *string `json:"id,omitzero"`
	URL       *string `json:"url,omitzero"`
	ExpiresAt *string `json:"expires_at,omitzero"`
}

type SignupForm

type SignupForm struct {
	Object                    string           `json:"object"`
	ID                        string           `json:"id"`
	Name                      string           `json:"name"`
	Fields                    []string         `json:"fields"`
	ButtonText                string           `json:"button_text"`
	ButtonColor               string           `json:"button_color"`
	SuccessMessage            string           `json:"success_message"`
	DoubleOptIn               bool             `json:"double_opt_in"`
	RedirectURL               Nullable[string] `json:"redirect_url,omitzero"`
	CaptchaEnabled            bool             `json:"captcha_enabled"`
	CaptchaProvider           string           `json:"captcha_provider"`
	TurnstileSiteKey          Nullable[string] `json:"turnstile_site_key,omitzero"`
	TurnstileSecretConfigured bool             `json:"turnstile_secret_configured"`
	BlockDisposableEmails     bool             `json:"block_disposable_emails"`
	Active                    bool             `json:"active"`
	// ConfirmationEmailFrom: Sender of the double opt-in confirmation email. Create, retrieve and update return it; list items leave it out.
	ConfirmationEmailFrom Nullable[string] `json:"confirmation_email_from,omitzero"`
	// WelcomeEmailEnabled: Create, retrieve and update return it; list items leave it out.
	WelcomeEmailEnabled *bool `json:"welcome_email_enabled,omitzero"`
	// WelcomeEmailFrom: Create, retrieve and update return it; list items leave it out.
	WelcomeEmailFrom Nullable[string] `json:"welcome_email_from,omitzero"`
	// WelcomeEmailSubject: Create, retrieve and update return it; list items leave it out.
	WelcomeEmailSubject Nullable[string] `json:"welcome_email_subject,omitzero"`
	// WelcomeEmailMarkdown: Create, retrieve and update return it; list items leave it out.
	WelcomeEmailMarkdown Nullable[string] `json:"welcome_email_markdown,omitzero"`
	// WelcomeStats: Welcome emails sent and skipped for this form, and how many were delivered, opened and clicked. List items leave it out.
	WelcomeStats *SignupFormWelcomeStats `json:"welcome_stats,omitzero"`
	// PendingConfirmationsCount: Signups waiting on their confirmation click. List items leave it out.
	PendingConfirmationsCount *int64 `json:"pending_confirmations_count,omitzero"`
	// RecentPendingConfirmations: Up to 5 of the newest pending signups. List items leave it out.
	RecentPendingConfirmations []SignupFormRecentPendingConfirmationsItem `json:"recent_pending_confirmations,omitzero"`
	CreatedAt                  string                                     `json:"created_at"`
	UpdatedAt                  string                                     `json:"updated_at"`
}

type SignupFormDeleted

type SignupFormDeleted struct {
	Object  string `json:"object"`
	ID      string `json:"id"`
	Deleted bool   `json:"deleted"`
}

type SignupFormList

type SignupFormList struct {
	Object  string       `json:"object"`
	HasMore bool         `json:"has_more"`
	Data    []SignupForm `json:"data"`
}

type SignupFormRecentPendingConfirmationsItem

type SignupFormRecentPendingConfirmationsItem struct {
	ID        *string          `json:"id,omitzero"`
	Email     *string          `json:"email,omitzero"`
	FirstName Nullable[string] `json:"first_name,omitzero"`
	LastName  Nullable[string] `json:"last_name,omitzero"`
	CreatedAt *string          `json:"created_at,omitzero"`
	ExpiresAt *string          `json:"expires_at,omitzero"`
}

type SignupFormWelcomeStats

type SignupFormWelcomeStats struct {
	Sent      *int64 `json:"sent,omitzero"`
	Skipped   *int64 `json:"skipped,omitzero"`
	Delivered *int64 `json:"delivered,omitzero"`
	Opened    *int64 `json:"opened,omitzero"`
	Clicked   *int64 `json:"clicked,omitzero"`
}

SignupFormWelcomeStats: Welcome emails sent and skipped for this form, and how many were delivered, opened and clicked. List items leave it out.

type StringList

type StringList []string

StringList is a list of strings that also reads a single JSON string, for fields such as to and cc that take one address or several.

func (*StringList) UnmarshalJSON

func (l *StringList) UnmarshalJSON(b []byte) error

UnmarshalJSON accepts a string or an array of strings.

type Success

type Success struct {
	Success bool `json:"success"`
}

type Suppression

type Suppression struct {
	Object *string `json:"object,omitzero"`
	ID     string  `json:"id"`
	Email  string  `json:"email"`
	Reason string  `json:"reason"`
	Source string  `json:"source"`
	// Scope: all: every send to the address is blocked. marketing: only marketing email is blocked, and email labelled transactional still goes out. A recipient's
	Scope          string                   `json:"scope"`
	BounceType     Nullable[string]         `json:"bounce_type,omitzero"`
	DiagnosticCode Nullable[string]         `json:"diagnostic_code,omitzero"`
	FeedbackID     Nullable[string]         `json:"feedback_id,omitzero"`
	EmailID        Nullable[string]         `json:"email_id,omitzero"`
	EventID        Nullable[string]         `json:"event_id,omitzero"`
	CreatedAt      string                   `json:"created_at"`
	UpdatedAt      *string                  `json:"updated_at,omitzero"`
	Metadata       map[string]any           `json:"metadata,omitzero"`
	RelatedEmail   Nullable[map[string]any] `json:"related_email,omitzero"`
	RelatedEvent   Nullable[map[string]any] `json:"related_event,omitzero"`
}

type SuppressionDeleted

type SuppressionDeleted struct {
	Object      string `json:"object"`
	Suppression string `json:"suppression"`
	Email       string `json:"email"`
	Deleted     bool   `json:"deleted"`
	// AccountList: What happened at Amazon SES's account-level suppression list. Hard-bounce and complaint suppressions are released there too (removed, or absent when S
	AccountList string `json:"account_list"`
}

type SuppressionList

type SuppressionList struct {
	Object   string        `json:"object"`
	HasMore  bool          `json:"has_more"`
	Data     []Suppression `json:"data"`
	Page     *int64        `json:"page,omitzero"`
	PageSize *int64        `json:"page_size,omitzero"`
	// FilteredTotal: Suppressions matching q and reason
	FilteredTotal *int64 `json:"filtered_total,omitzero"`
	// Total: Every suppression of the team
	Total       *int64 `json:"total,omitzero"`
	HardBounces *int64 `json:"hard_bounces,omitzero"`
	Complaints  *int64 `json:"complaints,omitzero"`
	Manual      *int64 `json:"manual,omitzero"`
}

type SuppressionsService

type SuppressionsService struct {
	// contains filtered or unexported fields
}

SuppressionsService groups the suppressions operations.

func (*SuppressionsService) AddBatch

func (s *SuppressionsService) AddBatch(ctx context.Context, params *AddSuppressionsBatchParams, opts ...RequestOption) (map[string]any, error)

AddBatch: Suppress addresses in bulk (POST /v1/suppressions/batch/add).

func (*SuppressionsService) Create

Create: Create a manual suppression (POST /v1/suppressions).

func (*SuppressionsService) Delete

Delete: Delete a suppression (DELETE /v1/suppressions/{id}).

func (*SuppressionsService) Get

Get: Retrieve a suppression (GET /v1/suppressions/{id}).

func (*SuppressionsService) List

List: List suppressions (GET /v1/suppressions).

func (*SuppressionsService) RemoveBatch

func (s *SuppressionsService) RemoveBatch(ctx context.Context, params *RemoveSuppressionsBatchParams, opts ...RequestOption) (map[string]any, error)

RemoveBatch: Remove suppressions in bulk (POST /v1/suppressions/batch/remove).

type TeamInvite

type TeamInvite struct {
	Object    string  `json:"object"`
	ID        string  `json:"id"`
	Email     string  `json:"email"`
	Role      string  `json:"role"`
	CreatedAt *string `json:"created_at,omitzero"`
	ExpiresAt string  `json:"expires_at"`
}

type TeamInvitesService

type TeamInvitesService struct {
	// contains filtered or unexported fields
}

TeamInvitesService groups the team.invites operations.

func (*TeamInvitesService) Create

Create: Invite someone to the team (POST /v1/team/invites).

func (*TeamInvitesService) Get

func (s *TeamInvitesService) Get(ctx context.Context, id string, opts ...RequestOption) (*TeamInvite, error)

Get: Retrieve a pending invitation (GET /v1/team/invites/{id}).

func (*TeamInvitesService) List

List: List pending invitations (GET /v1/team/invites).

func (*TeamInvitesService) Revoke

func (s *TeamInvitesService) Revoke(ctx context.Context, id string, opts ...RequestOption) (map[string]any, error)

Revoke: Revoke an invitation (DELETE /v1/team/invites/{id}).

type TeamMember

type TeamMember struct {
	Object string `json:"object"`
	// ID: The membership ID
	ID     string           `json:"id"`
	UserID string           `json:"user_id"`
	Email  string           `json:"email"`
	Name   Nullable[string] `json:"name,omitzero"`
	Role   string           `json:"role"`
	// CanManageBilling: Always true for owners
	CanManageBilling bool `json:"can_manage_billing"`
	// CreatedAt: When they joined
	CreatedAt string `json:"created_at"`
}

type TeamMembersService

type TeamMembersService struct {
	// contains filtered or unexported fields
}

TeamMembersService groups the team.members operations.

func (*TeamMembersService) List

List: List team members (GET /v1/team/members).

func (*TeamMembersService) Remove

func (s *TeamMembersService) Remove(ctx context.Context, id string, opts ...RequestOption) (map[string]any, error)

Remove: Remove a member (DELETE /v1/team/members/{id}).

func (*TeamMembersService) Update

func (s *TeamMembersService) Update(ctx context.Context, id string, params *UpdateTeamMemberParams, opts ...RequestOption) (map[string]any, error)

Update: Change a member's role or billing access (PATCH /v1/team/members/{id}).

type TeamService

type TeamService struct {
	Members *TeamMembersService
	Invites *TeamInvitesService
	// contains filtered or unexported fields
}

TeamService groups the team operations.

type Template

type Template struct {
	Object *string `json:"object,omitzero"`
	ID     *string `json:"id,omitzero"`
	// CurrentVersionID: Id of the published version; null until the first publish.
	CurrentVersionID Nullable[string]   `json:"current_version_id,omitzero"`
	Alias            Nullable[string]   `json:"alias,omitzero"`
	Name             *string            `json:"name,omitzero"`
	Status           *string            `json:"status,omitzero"`
	PublishedAt      Nullable[string]   `json:"published_at,omitzero"`
	CreatedAt        *string            `json:"created_at,omitzero"`
	UpdatedAt        *string            `json:"updated_at,omitzero"`
	From             Nullable[string]   `json:"from,omitzero"`
	Subject          Nullable[string]   `json:"subject,omitzero"`
	ReplyTo          Nullable[[]string] `json:"reply_to,omitzero"`
	HTML             Nullable[string]   `json:"html,omitzero"`
	Text             Nullable[string]   `json:"text,omitzero"`
	Variables        []TemplateVariable `json:"variables,omitzero"`
	// HasUnpublishedVersions: The draft differs from the published version. Always true before the first publish.
	HasUnpublishedVersions *bool `json:"has_unpublished_versions,omitzero"`
	// PreviewText: Not in Resend.
	PreviewText Nullable[string] `json:"preview_text,omitzero"`
	// Markdown: Not in Resend.
	Markdown Nullable[string] `json:"markdown,omitzero"`
	// Category: Not in Resend.
	Category Nullable[string] `json:"category,omitzero"`
}

type TemplateDeleted

type TemplateDeleted struct {
	Object  *string `json:"object,omitzero"`
	ID      *string `json:"id,omitzero"`
	Deleted *bool   `json:"deleted,omitzero"`
}

type TemplateError

type TemplateError struct {
	StatusCode *int64 `json:"statusCode,omitzero"`
	// Name: validation_error, not_found or conflict
	Name    *string `json:"name,omitzero"`
	Message *string `json:"message,omitzero"`
	Error   *string `json:"error,omitzero"`
}

TemplateError: Resend's error shape, plus error with the same text as message.

type TemplateList

type TemplateList struct {
	Object  string            `json:"object"`
	Data    []TemplateSummary `json:"data"`
	HasMore bool              `json:"has_more"`
}

type TemplateRef

type TemplateRef struct {
	ID     *string `json:"id,omitzero"`
	Object *string `json:"object,omitzero"`
	// UpdatedAt: Not in Resend. The revision this write created.
	UpdatedAt *string `json:"updated_at,omitzero"`
	// Status: Not in Resend.
	Status *string `json:"status,omitzero"`
	// PublishedAt: Not in Resend.
	PublishedAt Nullable[string] `json:"published_at,omitzero"`
	// HasUnpublishedVersions: Not in Resend.
	HasUnpublishedVersions *bool `json:"has_unpublished_versions,omitzero"`
}

TemplateRef: Resend's { id, object }. Create, update and publish also return the fields below (not in Resend): updated_at is the revision that write set, to pass a

type TemplateSummary

type TemplateSummary struct {
	ID          *string          `json:"id,omitzero"`
	Name        *string          `json:"name,omitzero"`
	Status      *string          `json:"status,omitzero"`
	PublishedAt Nullable[string] `json:"published_at,omitzero"`
	CreatedAt   *string          `json:"created_at,omitzero"`
	UpdatedAt   *string          `json:"updated_at,omitzero"`
	Alias       Nullable[string] `json:"alias,omitzero"`
	// Subject: Not in Resend.
	Subject Nullable[string] `json:"subject,omitzero"`
	// Category: Not in Resend.
	Category Nullable[string] `json:"category,omitzero"`
	// HasUnpublishedVersions: Not in Resend's list rows.
	HasUnpublishedVersions *bool `json:"has_unpublished_versions,omitzero"`
}

type TemplateVariable

type TemplateVariable struct {
	ID *string `json:"id,omitzero"`
	// Key: Use it in the content as {{{KEY}}}. Letters, digits and underscores. FIRST_NAME, LAST_NAME, EMAIL, UNSUBSCRIBE_URL, RESEND_UNSUBSCRIBE_URL, contact an
	Key  string `json:"key"`
	Type string `json:"type"`
	// FallbackValue: Used when a send gives no value. Must match the type. Without one, every send must pass a value for this variable or it answers 422.
	FallbackValue Nullable[any] `json:"fallback_value,omitzero"`
	CreatedAt     *string       `json:"created_at,omitzero"`
	UpdatedAt     *string       `json:"updated_at,omitzero"`
}

type TemplatesService

type TemplatesService struct {
	// contains filtered or unexported fields
}

TemplatesService groups the templates operations.

func (*TemplatesService) Create

Create: Create a template (POST /v1/templates).

func (*TemplatesService) Delete

func (s *TemplatesService) Delete(ctx context.Context, id string, opts ...RequestOption) (*TemplateDeleted, error)

Delete: Delete a template (DELETE /v1/templates/{id}).

func (*TemplatesService) Duplicate

func (s *TemplatesService) Duplicate(ctx context.Context, id string, opts ...RequestOption) (*TemplateRef, error)

Duplicate: Duplicate a template (POST /v1/templates/{id}/duplicate).

func (*TemplatesService) Get

func (s *TemplatesService) Get(ctx context.Context, id string, opts ...RequestOption) (*Template, error)

Get: Get a template (GET /v1/templates/{id}).

func (*TemplatesService) List

List: List templates (GET /v1/templates).

func (*TemplatesService) ListAll

ListAll iterates over every item of List, fetching the following pages as needed.

func (*TemplatesService) Publish

func (s *TemplatesService) Publish(ctx context.Context, id string, params *PublishTemplateParams, opts ...RequestOption) (*TemplateRef, error)

Publish: Publish a template (POST /v1/templates/{id}/publish).

func (*TemplatesService) Update

Update: Update a template (PATCH /v1/templates/{id}).

type TestWebhookResponse

type TestWebhookResponse struct {
	// Success: Whether the test payload was delivered successfully
	Success *bool `json:"success,omitzero"`
	// Status: HTTP status code returned by the webhook endpoint, null when it did not answer
	Status   Nullable[int64]  `json:"status,omitzero"`
	Message  *string          `json:"message,omitzero"`
	Delivery *WebhookDelivery `json:"delivery,omitzero"`
}

type UpdateAPIKeyParams

type UpdateAPIKeyParams struct {
	Name *string `json:"name,omitzero"`
	// Scopes: Replaces the key's scopes
	Scopes []string `json:"scopes,omitzero"`
}

type UpdateAPIKeyResponse

type UpdateAPIKeyResponse struct {
	ID        *string  `json:"id,omitzero"`
	Name      *string  `json:"name,omitzero"`
	KeyPrefix *string  `json:"keyPrefix,omitzero"`
	Scopes    []string `json:"scopes,omitzero"`
}

type UpdateBroadcastRequest

type UpdateBroadcastRequest struct {
	Name     *string `json:"name,omitzero"`
	Audience *string `json:"audience,omitzero"`
	// SegmentID: Required when audience is segment
	SegmentID *string `json:"segment_id,omitzero"`
	// AudienceMeta: Details of the audience, such as the segment_id
	AudienceMeta map[string]any `json:"audience_meta,omitzero"`
	// TemplateID: Not in Resend, and only on create (PATCH ignores it). Start from a template (id or alias): its current content, as the template editor shows it, is co
	TemplateID  *string          `json:"template_id,omitzero"`
	From        *string          `json:"from,omitzero"`
	ReplyTo     Nullable[string] `json:"reply_to,omitzero"`
	Subject     *string          `json:"subject,omitzero"`
	PreviewText Nullable[string] `json:"preview_text,omitzero"`
	// Markdown: Markdown body. Must include {{unsubscribe_url}} or {{{RESEND_UNSUBSCRIBE_URL}}} before sending.
	Markdown    *string          `json:"markdown,omitzero"`
	HTML        Nullable[string] `json:"html,omitzero"`
	Text        Nullable[string] `json:"text,omitzero"`
	TrackOpens  *bool            `json:"track_opens,omitzero"`
	TrackClicks *bool            `json:"track_clicks,omitzero"`
	// SendOverMinutes: Not in Resend. Spread the send evenly over this many minutes from the send time (or scheduled_at): recipient i of N goes out at start + i * window / N
	SendOverMinutes Nullable[int64] `json:"send_over_minutes,omitzero"`
}

type UpdateContactPropertyParams

type UpdateContactPropertyParams struct {
	// FallbackValue: The new fallback; null clears it. key and type cannot change.
	FallbackValue any `json:"fallback_value"`
}

type UpdateContactPropertyResponse

type UpdateContactPropertyResponse struct {
	ContactProperty ContactProperty `json:"contact_property"`
}

type UpdateContactRequest

type UpdateContactRequest struct {
	FirstName    *string        `json:"firstName,omitzero"`
	LastName     *string        `json:"lastName,omitzero"`
	FirstName_   *string        `json:"first_name,omitzero"`
	LastName_    *string        `json:"last_name,omitzero"`
	Unsubscribed *bool          `json:"unsubscribed,omitzero"`
	Properties   map[string]any `json:"properties,omitzero"`
	// SegmentIDs: Replace this contact's manual segment assignments
	SegmentIDs []string `json:"segment_ids,omitzero"`
}

type UpdateDomainReceivingParams

type UpdateDomainReceivingParams struct {
	ReceivingEnabled bool `json:"receiving_enabled"`
}

type UpdateDomainReceivingResponse

type UpdateDomainReceivingResponse struct {
	ID        *string          `json:"id,omitzero"`
	Receiving *DomainReceiving `json:"receiving,omitzero"`
}

type UpdateEmailParams

type UpdateEmailParams struct {
	// ScheduledAt: New send time in ISO 8601. Must be in the future and within 30 days.
	ScheduledAt string `json:"scheduled_at"`
}

type UpdateEmailResponse

type UpdateEmailResponse struct {
	Object      string `json:"object"`
	ID          string `json:"id"`
	ScheduledAt string `json:"scheduled_at"`
}

type UpdateInboxDraftParams

type UpdateInboxDraftParams struct {
	To      Nullable[StringList] `json:"to,omitzero"`
	Cc      Nullable[StringList] `json:"cc,omitzero"`
	Bcc     Nullable[StringList] `json:"bcc,omitzero"`
	Subject Nullable[string]     `json:"subject,omitzero"`
	HTML    Nullable[string]     `json:"html,omitzero"`
	Text    Nullable[string]     `json:"text,omitzero"`
	// Revision: Only write if the draft is still at this revision. Not in Resend.
	Revision *int64 `json:"revision,omitzero"`
}

type UpdateInboxLabelParams

type UpdateInboxLabelParams struct {
	Name  *string `json:"name,omitzero"`
	Color *string `json:"color,omitzero"`
}

type UpdateInboxLabelResponse

type UpdateInboxLabelResponse struct {
	Object *string `json:"object,omitzero"`
	ID     *string `json:"id,omitzero"`
}

type UpdateInboxParams

type UpdateInboxParams struct {
	Name     *string          `json:"name,omitzero"`
	FromName Nullable[string] `json:"from_name,omitzero"`
}

type UpdateInboxResponse

type UpdateInboxResponse struct {
	Object *string `json:"object,omitzero"`
	ID     *string `json:"id,omitzero"`
}

type UpdateInboxThreadParams

type UpdateInboxThreadParams struct {
	Read   *bool   `json:"read,omitzero"`
	Folder *string `json:"folder,omitzero"`
	// LabelID: Apply this label of the same inbox
	LabelID *string `json:"label_id,omitzero"`
	// RemoveLabelID: Remove this label. Not in Resend.
	RemoveLabelID *string `json:"remove_label_id,omitzero"`
}

type UpdateReceivedEmailParams

type UpdateReceivedEmailParams struct {
	Read bool `json:"read"`
}

type UpdateReceivedEmailResponse

type UpdateReceivedEmailResponse struct {
	Object *string          `json:"object,omitzero"`
	ID     *string          `json:"id,omitzero"`
	ReadAt Nullable[string] `json:"read_at,omitzero"`
}

type UpdateSegmentRequest

type UpdateSegmentRequest struct {
	Name        *string          `json:"name,omitzero"`
	Description Nullable[string] `json:"description,omitzero"`
	Color       Nullable[string] `json:"color,omitzero"`
}

type UpdateSignupFormRequest

type UpdateSignupFormRequest struct {
	Name             *string          `json:"name,omitzero"`
	Fields           []string         `json:"fields,omitzero"`
	ButtonText       *string          `json:"button_text,omitzero"`
	ButtonColor      *string          `json:"button_color,omitzero"`
	SuccessMessage   *string          `json:"success_message,omitzero"`
	DoubleOptIn      *bool            `json:"double_opt_in,omitzero"`
	RedirectURL      Nullable[string] `json:"redirect_url,omitzero"`
	CaptchaEnabled   *bool            `json:"captcha_enabled,omitzero"`
	CaptchaProvider  *string          `json:"captcha_provider,omitzero"`
	TurnstileSiteKey Nullable[string] `json:"turnstile_site_key,omitzero"`
	// TurnstileSecretKey: Write-only. Omit to keep the existing secret.
	TurnstileSecretKey    Nullable[string] `json:"turnstile_secret_key,omitzero"`
	BlockDisposableEmails *bool            `json:"block_disposable_emails,omitzero"`
	Active                *bool            `json:"active,omitzero"`
	// ConfirmationEmailFrom: Sender of the double opt-in confirmation email. The platform address is used when this is unset or its domain is not verified.
	ConfirmationEmailFrom Nullable[string] `json:"confirmation_email_from,omitzero"`
	// WelcomeEmailEnabled: Send a welcome email to each new contact from this form.
	WelcomeEmailEnabled *bool `json:"welcome_email_enabled,omitzero"`
	// WelcomeEmailFrom: Sender of the welcome email. Its domain must be verified, or the welcome email is skipped.
	WelcomeEmailFrom    Nullable[string] `json:"welcome_email_from,omitzero"`
	WelcomeEmailSubject Nullable[string] `json:"welcome_email_subject,omitzero"`
	// WelcomeEmailMarkdown: Welcome email body as Markdown.
	WelcomeEmailMarkdown Nullable[string] `json:"welcome_email_markdown,omitzero"`
}

UpdateSignupFormRequest: Only the fields sent change. Keys are snake_case, as in the form object. The older camelCase spelling of each key (buttonText, doubleOptIn, welcomeEma

type UpdateTeamMemberParams

type UpdateTeamMemberParams struct {
	Role             *string `json:"role,omitzero"`
	CanManageBilling *bool   `json:"can_manage_billing,omitzero"`
}

type UpdateTemplateRequest

type UpdateTemplateRequest struct {
	Name *string `json:"name,omitzero"`
	// Alias: A second handle, unique in the team, that works wherever the id does.
	Alias Nullable[string] `json:"alias,omitzero"`
	// From: Default sender, e.g. "Acme <orders@acme.com>". A send can override it.
	From Nullable[string] `json:"from,omitzero"`
	// Subject: Default subject. Can use variables. A send can override it.
	Subject Nullable[string] `json:"subject,omitzero"`
	// ReplyTo: Default Reply-To address or addresses. A send can override it.
	ReplyTo Nullable[StringList] `json:"reply_to,omitzero"`
	// HTML: The HTML body. Variables are written {{{KEY}}}, optionally with an inline fallback: {{{KEY|default}}}.
	HTML Nullable[string] `json:"html,omitzero"`
	// Text: Plain-text body. When left out, the text part is generated from the HTML at send time. Exactly "" stops that, as in Resend; the email then carries an
	Text Nullable[string] `json:"text,omitzero"`
	// Markdown: Not in Resend. A Markdown body, rendered into SMTPfast's email layout. Used when html is empty.
	Markdown Nullable[string] `json:"markdown,omitzero"`
	// PreviewText: Not in Resend. The inbox preview line, put into the email as a hidden first line.
	PreviewText Nullable[string] `json:"preview_text,omitzero"`
	// Category: Not in Resend. A label for grouping templates in the dashboard.
	Category  Nullable[string]             `json:"category,omitzero"`
	Variables Nullable[[]TemplateVariable] `json:"variables,omitzero"`
	// ExpectedUpdatedAt: Not in Resend. The updated_at you loaded. If the template changed since, the update is refused with 409 revision_conflict instead of overwriting the n
	ExpectedUpdatedAt *string `json:"expected_updated_at,omitzero"`
}

UpdateTemplateRequest: Any field of CreateTemplateRequest. Only the fields sent change; variables, when sent, replace the whole list.

type UpdateWebhookRequest

type UpdateWebhookRequest struct {
	URL *string `json:"url,omitzero"`
	// Events: List of event types to subscribe to. Legacy unprefixed email aliases are accepted and normalized to Resend-style email.* event names.
	Events []string `json:"events,omitzero"`
	// Active: Set to false to pause delivery without deleting the webhook
	Active *bool   `json:"active,omitzero"`
	Format *string `json:"format,omitzero"`
}

type Usage

type Usage struct {
	Object   string        `json:"object"`
	Emails   UsageEmails   `json:"emails"`
	Contacts UsageContacts `json:"contacts"`
	Segments UsageSegments `json:"segments"`
	// Broadcasts: Broadcasts queued, scheduled or sent this month
	Broadcasts UsageBroadcasts `json:"broadcasts"`
	// AICredits: Not offered: always 0, with a null next_increase_at
	AICredits UsageAICredits `json:"ai_credits"`
	// AutomationRuns: Not offered: always 0
	AutomationRuns UsageAutomationRuns `json:"automation_runs"`
	// Domains: A null limit means no cap
	Domains UsageDomains `json:"domains"`
	// RateLimit: Per API key; null for a dashboard session
	RateLimit *UsageRateLimit `json:"rate_limit"`
}

type UsageAICredits

type UsageAICredits struct {
	Used           int64   `json:"used"`
	Limit          int64   `json:"limit"`
	NextIncreaseAt *string `json:"next_increase_at"`
}

UsageAICredits: Not offered: always 0, with a null next_increase_at

type UsageAutomationRuns

type UsageAutomationRuns struct {
	Used     int64  `json:"used"`
	Limit    int64  `json:"limit"`
	ResetsAt string `json:"resets_at"`
}

UsageAutomationRuns: Not offered: always 0

type UsageBroadcasts

type UsageBroadcasts struct {
	Used  int64 `json:"used"`
	Limit int64 `json:"limit"`
}

UsageBroadcasts: Broadcasts queued, scheduled or sent this month

type UsageContacts

type UsageContacts struct {
	Used  int64 `json:"used"`
	Limit int64 `json:"limit"`
}

type UsageDomains

type UsageDomains struct {
	Used  int64  `json:"used"`
	Limit *int64 `json:"limit"`
}

UsageDomains: A null limit means no cap

type UsageEmails

type UsageEmails struct {
	// Daily: The last 24 hours. There is no daily cap, so limit and resets_at are null.
	Daily UsageEmailsDaily `json:"daily"`
	// Monthly: This month. Received mail does not count, so used equals sent.
	Monthly UsageEmailsMonthly `json:"monthly"`
	Credits UsageEmailsCredits `json:"credits"`
	// EffectiveRemaining: What can still be sent before a send is refused: the monthly allowance left plus credits
	EffectiveRemaining int64 `json:"effective_remaining"`
}

type UsageEmailsCredits

type UsageEmailsCredits struct {
	// Balance: Prepaid credits
	Balance int64 `json:"balance"`
}

type UsageEmailsDaily

type UsageEmailsDaily struct {
	Used     int64   `json:"used"`
	Limit    *int64  `json:"limit"`
	Sent     int64   `json:"sent"`
	Received int64   `json:"received"`
	ResetsAt *string `json:"resets_at"`
}

UsageEmailsDaily: The last 24 hours. There is no daily cap, so limit and resets_at are null.

type UsageEmailsMonthly

type UsageEmailsMonthly struct {
	Used     int64  `json:"used"`
	Limit    int64  `json:"limit"`
	Sent     int64  `json:"sent"`
	Received int64  `json:"received"`
	ResetsAt string `json:"resets_at"`
}

UsageEmailsMonthly: This month. Received mail does not count, so used equals sent.

type UsageRateLimit

type UsageRateLimit struct {
	// Limit: Requests allowed per duration
	Limit    int64  `json:"limit"`
	Duration string `json:"duration"`
}

UsageRateLimit: Per API key; null for a dashboard session

type UsageSegments

type UsageSegments struct {
	Used  int64 `json:"used"`
	Limit int64 `json:"limit"`
}

type VerifyDomainResponse

type VerifyDomainResponse struct {
	Domain            *string                     `json:"domain,omitzero"`
	Status            *string                     `json:"status,omitzero"`
	VerificationPhase *string                     `json:"verification_phase,omitzero"`
	Checks            *VerifyDomainResponseChecks `json:"checks,omitzero"`
	MailFromDomain    Nullable[string]            `json:"mail_from_domain,omitzero"`
	SesConfigured     *bool                       `json:"ses_configured,omitzero"`
	// DKIMCheckRestarted: True when the email provider had stopped checking DKIM and this request restarted the check.
	DKIMCheckRestarted *bool   `json:"dkim_check_restarted,omitzero"`
	Message            *string `json:"message,omitzero"`
}

type VerifyDomainResponseChecks

type VerifyDomainResponseChecks struct {
	DKIM     *string `json:"dkim,omitzero"`
	SPF      *string `json:"spf,omitzero"`
	DMARC    *string `json:"dmarc,omitzero"`
	MailFrom *string `json:"mail_from,omitzero"`
}

type Webhook

type Webhook struct {
	ID     string   `json:"id"`
	URL    string   `json:"url"`
	Events []string `json:"events"`
	Active bool     `json:"active"`
	Format *string  `json:"format,omitzero"`
	// Secret: The signing secret. Returned once, in the create response.
	Secret    *string `json:"secret,omitzero"`
	CreatedAt string  `json:"created_at"`
	UpdatedAt *string `json:"updated_at,omitzero"`
}

Webhook: List and read responses also carry createdAt and updatedAt in camelCase for older clients.

type WebhookDelivery

type WebhookDelivery struct {
	Object      *string          `json:"object,omitzero"`
	ID          *string          `json:"id,omitzero"`
	WebhookID   *string          `json:"webhook_id,omitzero"`
	Event       *string          `json:"event,omitzero"`
	Status      *string          `json:"status,omitzero"`
	Attempts    *int64           `json:"attempts,omitzero"`
	MaxAttempts *int64           `json:"max_attempts,omitzero"`
	StatusCode  Nullable[int64]  `json:"status_code,omitzero"`
	DurationMs  Nullable[int64]  `json:"duration_ms,omitzero"`
	Error       Nullable[string] `json:"error,omitzero"`
	// Response: First 500 characters of the last response body
	Response      Nullable[string]                `json:"response,omitzero"`
	AttemptLog    []WebhookDeliveryAttemptLogItem `json:"attempt_log,omitzero"`
	NextAttemptAt Nullable[string]                `json:"next_attempt_at,omitzero"`
	DeliveredAt   Nullable[string]                `json:"delivered_at,omitzero"`
	CreatedAt     *string                         `json:"created_at,omitzero"`
}

type WebhookDeliveryAttemptLogItem

type WebhookDeliveryAttemptLogItem struct {
	At         *string          `json:"at,omitzero"`
	StatusCode Nullable[int64]  `json:"status_code,omitzero"`
	DurationMs *int64           `json:"duration_ms,omitzero"`
	Error      Nullable[string] `json:"error,omitzero"`
}

type WebhookEvent

type WebhookEvent struct {
	Object        *string          `json:"object,omitzero"`
	ID            *string          `json:"id,omitzero"`
	Type          *string          `json:"type,omitzero"`
	CreatedAt     *string          `json:"created_at,omitzero"`
	Status        *string          `json:"status,omitzero"`
	NextAttemptAt Nullable[string] `json:"next_attempt_at,omitzero"`
	// Payload: The body that was sent, parsed as JSON
	Payload any `json:"payload,omitzero"`
}

type WebhookEventSummary

type WebhookEventSummary struct {
	ID        *string `json:"id,omitzero"`
	Type      *string `json:"type,omitzero"`
	CreatedAt *string `json:"created_at,omitzero"`
	Status    *string `json:"status,omitzero"`
}

type WebhookUpdated

type WebhookUpdated struct {
	ID     string   `json:"id"`
	URL    string   `json:"url"`
	Events []string `json:"events"`
	Format string   `json:"format"`
	Active bool     `json:"active"`
}

WebhookUpdated: The update response has no timestamps; fetch the webhook for those.

type WebhooksDeliveriesService

type WebhooksDeliveriesService struct {
	// contains filtered or unexported fields
}

WebhooksDeliveriesService groups the webhooks.deliveries operations.

func (*WebhooksDeliveriesService) Get

Get: Get a webhook delivery (GET /v1/webhooks/{id}/deliveries/{delivery_id}).

func (*WebhooksDeliveriesService) List

List: List webhook deliveries (GET /v1/webhooks/{id}/deliveries).

func (*WebhooksDeliveriesService) ListAll

ListAll iterates over every item of List, fetching the following pages as needed.

func (*WebhooksDeliveriesService) Retry

Retry: Retry a webhook delivery (POST /v1/webhooks/{id}/deliveries/{delivery_id}/retry).

type WebhooksEventsAttemptsService

type WebhooksEventsAttemptsService struct {
	// contains filtered or unexported fields
}

WebhooksEventsAttemptsService groups the webhooks.events.attempts operations.

func (*WebhooksEventsAttemptsService) List

List: List the attempts of a webhook event (GET /v1/webhooks/{id}/events/{event_id}/attempts).

type WebhooksEventsService

type WebhooksEventsService struct {
	Attempts *WebhooksEventsAttemptsService
	// contains filtered or unexported fields
}

WebhooksEventsService groups the webhooks.events operations.

func (*WebhooksEventsService) Get

func (s *WebhooksEventsService) Get(ctx context.Context, id string, eventID string, opts ...RequestOption) (*WebhookEvent, error)

Get: Retrieve a webhook event (GET /v1/webhooks/{id}/events/{event_id}).

func (*WebhooksEventsService) List

List: List webhook events (GET /v1/webhooks/{id}/events).

func (*WebhooksEventsService) ListAll

ListAll iterates over every item of List, fetching the following pages as needed.

func (*WebhooksEventsService) Replay

Replay: Replay a webhook event (POST /v1/webhooks/{id}/events/{event_id}/replay).

type WebhooksService

type WebhooksService struct {
	Deliveries *WebhooksDeliveriesService
	Events     *WebhooksEventsService
	// contains filtered or unexported fields
}

WebhooksService groups the webhooks operations.

func (*WebhooksService) Create

func (s *WebhooksService) Create(ctx context.Context, params *CreateWebhookRequest, opts ...RequestOption) (*Webhook, error)

Create: Create webhook (POST /v1/webhooks).

func (*WebhooksService) Delete

func (s *WebhooksService) Delete(ctx context.Context, id string, opts ...RequestOption) (*Success, error)

Delete: Delete webhook (DELETE /v1/webhooks/{id}).

func (*WebhooksService) Get

func (s *WebhooksService) Get(ctx context.Context, id string, opts ...RequestOption) (*Webhook, error)

Get: Get webhook (GET /v1/webhooks/{id}).

func (*WebhooksService) List

List: List webhooks (GET /v1/webhooks).

func (*WebhooksService) Replace

func (s *WebhooksService) Replace(ctx context.Context, id string, params *UpdateWebhookRequest, opts ...RequestOption) (*WebhookUpdated, error)

Replace: Update webhook (PUT /v1/webhooks/{id}).

func (*WebhooksService) RotateSigningSecret

func (s *WebhooksService) RotateSigningSecret(ctx context.Context, id string, opts ...RequestOption) (*RotateWebhookSigningSecretResponse, error)

RotateSigningSecret: Rotate a webhook signing secret (POST /v1/webhooks/{id}/signing-secret/rotate).

func (*WebhooksService) Test

Test: Test webhook (POST /v1/webhooks/{id}/test).

func (*WebhooksService) Update

Update: Update webhook (PATCH /v1/webhooks/{id}).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL