Go client for managing domains, mailboxes, sending accounts, billing, logs, and webhooks.
go get sendmux.ai/go@latestimport "sendmux.ai/go/management"Use a root API key with the smx_root_ prefix. management.New validates the prefix before creating the client.
package main
import (
"context"
"fmt"
"os"
"sendmux.ai/go/management"
)
func main() {
ctx := context.Background()
client, err := management.New(os.Getenv("SENDMUX_API_KEY"))
if err != nil {
panic(err)
}
res, err := client.ManagementListDomains(ctx, management.ManagementListDomainsParams{
Limit: management.NewOptInt(25),
})
if err != nil {
panic(err)
}
page, ok := res.(*management.DomainItemCursorListResponse)
if !ok {
panic(fmt.Sprintf("list domains failed: %T", res))
}
for _, domain := range page.GetData() {
fmt.Println(domain.GetID(), domain.GetDomain())
}
}WithBaseURLoverrides the API base URL.WithHTTPClientsupplies the base HTTP client.WithRetryOptionsconfigures retry and rate-limit backoff behaviour.IdempotencyKeysets theIdempotency-Keyheader for create and action requests.IfMatchandIfNoneMatchset conditional request headers where supported.APIErrorFromResponsemaps generated error responses intocore.APIError.
- Management API: https://sendmux.ai/docs/api/introduction
- Domain guide: https://sendmux.ai/docs/guides/domain-management
- Go reference: https://pkg.go.dev/sendmux.ai/go/management