Go SDK
Official Go SDK for the Truelist email validation API.
Installation
go get github.com/Truelist-io-Email-Validation/truelist-go Requires Go 1.21+.
Note
Start free — 100 validations + 10 enhanced credits, no credit card required. Get your API key.
Quick start
import truelist "github.com/Truelist-io-Email-Validation/truelist-go"
client := truelist.NewClient("your-api-key")
result, err := client.Validate(context.Background(), "user@example.com")
fmt.Println(result.State) // "ok"
fmt.Println(result.IsValid()) // true Configuration
client := truelist.NewClient("your-api-key",
truelist.WithTimeout(10 * time.Second),
truelist.WithMaxRetries(2),
) | Option | Default | Description |
|---|---|---|
WithBaseURL | https://api.truelist.io | Custom API URL |
WithTimeout | 30s | HTTP timeout |
WithMaxRetries | 3 | Max retries for 429/5xx |
WithHTTPClient | default | Custom *http.Client |
Result fields
| Field | Type | Description |
|---|---|---|
Email | string | Validated email |
Domain | string | Email domain |
State | string | ok, email_invalid, accept_all, unknown |
SubState | string | Detailed sub-state |
Suggestion | *string | Typo suggestion |
MxRecord | *string | MX record |
VerifiedAt | string | Timestamp |
Predicates
IsValid(), IsInvalid(), IsAcceptAll(), IsDisposable(), IsRole()
Error handling
if errors.Is(err, truelist.ErrAuthentication) {
// 401 — never retried
}
if errors.Is(err, truelist.ErrRateLimit) {
// 429
}
var apiErr *truelist.APIError
if errors.As(err, &apiErr) {
fmt.Println(apiErr.StatusCode)
} Account info
account, err := client.Account(ctx)
fmt.Println(account.Email)
fmt.Println(account.Account.PaymentPlan) Package link
| Package | Install |
|---|---|
| truelist-go | go get github.com/Truelist-io-Email-Validation/truelist-go |
Note
**Prefer an AI-first workflow?** Validate emails conversationally in Claude, Cursor, or VS Code Copilot using our hosted MCP server. No API key required.