Skip to Content
SDKsGoAuth & Accounts

Auth & Accounts

Auth and account methods ship as flat methods on the client. Auth/account routes are public or bearer-token based; the rest follow the JWT or API-key auth modes.

GroupMethods
Auth & accountsRegister, Login, Refresh, SendVerificationEmail, VerifyEmail, ResetPassword, ResetPasswordConfirm, OAuthExchange, Me, UpdateMe, Logout, ChangePassword, SendPhoneOTP, VerifyPhone, ListAPIKeys, CreateAPIKey, DeleteAPIKey

Example: login → bearer client → profile

login, err := client.Login(ctx, "dev@example.com", "s3cret") authed := sendafrica.NewClient("", sendafrica.WithBearerToken(login.AccessToken)) profile, err := authed.Me(ctx) if err != nil { // token expired or invalid }

Example: manage API keys

keys, err := client.ListAPIKeys(ctx) for _, k := range keys { fmt.Println(k.ID, k.Name) } key, err := client.CreateAPIKey(ctx, sendafrica.CreateAPIKeyRequest{ Name: "staging", }) fmt.Println(key.Key) // shown once err = client.DeleteAPIKey(ctx, key.ID)

Health check

client.Health(ctx) — unauthenticated GET /health, never retried. Useful for ping-style monitoring:

status, err := client.Health(ctx) fmt.Println(status)

Keep the account API key on the server — see Client & Authentication.

Last updated on