---
title: "Configuration"
description: "Set up the client with your API key, retries and timeouts."
url: "https://docs.goomzo.africa/docs/developers/go-sdk/configuration"
docs_index: /llms.txt
lastUpdated: 2026-11-12
section: "Get started"
---

> For an index of all documentation, see [/llms.txt](https://docs.goomzo.africa/llms.txt). Any page is also available as Markdown by adding .md to its URL.

# Configuration

> Set up the client with your API key, retries and timeouts.

The client reads its settings once, when you make it. Make one and share it: it's safe to use from many goroutines.

## Options

```go
client, err := goomzo.NewClient(
	goomzo.WithAPIKey(os.Getenv("GOOMZO_API_KEY")),
	goomzo.WithMaxRetries(2),
	goomzo.WithTimeout(60*time.Second),
)
```

| Option           | Description                                            | Default                     |
| ---------------- | ------------------------------------------------------ | --------------------------- |
| `WithAPIKey`     | Your API key's secret.                                 | `GOOMZO_API_KEY`            |
| `WithMaxRetries` | How many times a failed request is tried again.        | `2`                         |
| `WithTimeout`    | How long to wait for each try.                         | `60s`                       |
| `WithBaseURL`    | Where the API is.                                      | `https://api.goomzo.africa` |
| `WithHTTPClient` | Your own `*http.Client`, such as for a proxy or tests. | `http.DefaultClient`        |

**Important:** Keep the API key on your server. Never put it in code that runs in a browser or an app.

## Contexts

Every call takes a `context.Context`. Its deadline covers the call and every retry:

```go
ctx, cancel := context.WithTimeout(ctx, 10*time.Second)
defer cancel()
msg, err := client.Messages.Get(ctx, "msg_7c1x9v2b4n6m8q0w")
```

## Idempotency keys

Every call that creates something takes `WithIdempotencyKey`, so a retry from your side isn't done twice. Left out,
one is made for each call.

```go
client.Messages.SendOne(ctx, goomzo.MessageInput{
	To:      "+255712345678",
	Channel: goomzo.SMS,
	Content: &goomzo.Content{Text: "Your order is ready."},
}, goomzo.WithIdempotencyKey("order-1042-ready"))
```

## API version

The SDK sends the `Goomzo-Version` it was written for, as `goomzo.APIVersion`.

## Next steps

- [Send messages](https://docs.goomzo.africa/docs/developers/go-sdk/messages?utm_source=llms&utm_medium=ai)
- [Errors](https://docs.goomzo.africa/docs/developers/go-sdk/errors?utm_source=llms&utm_medium=ai)

---

For an index of all available documentation, see [/llms.txt](https://docs.goomzo.africa/llms.txt)
