AddressZen Go SDK
go.addresszen.com/sdk calls the AddressZen API from Go 1.26 or later, with a typed method for each operation and no dependencies beyond the standard library.
go get go.addresszen.com/sdk
package main
import (
"context"
"fmt"
"log"
addresszen "go.addresszen.com/sdk"
)
func main() {
client := addresszen.NewClient("ak_test")
res, err := client.AddressVerify(context.Background(), addresszen.AddressVerifyBody{
Query: "1010 Cauthen Ln, Alamogordo, NM 88310",
}, nil)
if err != nil {
log.Fatal(err)
}
if m := res.Result.AsUsaVerifyMatch(); m != nil {
fmt.Printf("%s, %s, %s %s\n", m.AddressLineOne, m.City, m.State, m.ZipCode)
}
}
The package name is addresszen; import it under that name, as above. Each API operation is one method on the client, named from its operation ID, such as AddressVerify() or FindAddress(). Every method takes a context.Context first and returns a typed response and an error.
Features
Every operation in the API has a method. The ones most integrations need have a guide:
- Address verification: correct and standardize a US address against USPS data
- Autocomplete: suggest addresses as the user types, in the US and other countries
- Email validation: check that an address can receive mail
- Phone validation: check a number from any country and format it
- API keys and licensees: balances, limits, usage and sub-licensing
Place search and saved configs are on the endpoint pages, one per method.
Why the SDK
- Standard library only. Requests go through
net/http. Pass your own*http.Clientfor timeouts, proxies or tracing. There is nothing else to install or keep patched. - Generated from the OpenAPI spec. Every response is a struct. Every dataset's native record has its own type, from
UspsAddresstoMoisAddress. - Responses never fail on shape. A field the API adds, a value outside a known set or a dataset the SDK has not seen yet decodes without error. See responses.
- No hidden retries. A billable lookup repeats only when your code repeats it.
Coding agents
- Agent skill.
npx skills add addresszen/skillsinstalls theazn-go-sdkskill, built from these pages. - Endpoints. Every operation, grouped by API area, with its signature, parameters, response type and a tested example.
- Markdown pages. Add
.mdto any page URL for plain markdown, such as/docs/sdks/go/errors.md. - llms.txt. An index of every page on this site.
- OpenAPI spec. The API contract the SDK is generated from.
Authenticate
Pass your API key to NewClient(). Key, licensee and configuration operations also need a Management Key, passed with WithManagementKey(). Keep the Management Key on your server. See setup.
Errors
An HTTP error returns *addresszen.APIError with the HTTP status and the API error code and message. Match it with errors.AsType. A failed connection returns the net/http error, wrapped. See error handling.