---
title: "Configuration"
description: "Set up the client with your API key, retries and timeouts."
url: "https://docs.goomzo.africa/docs/developers/python-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 across your app.

## Options

```python
import os
from goomzo import Goomzo

goomzo = Goomzo(
    api_key=os.environ['GOOMZO_API_KEY'],
    max_retries=2,
    timeout=60.0,
)
```

| Option        | Description                                                                                           | Default                     |
| ------------- | ----------------------------------------------------------------------------------------------------- | --------------------------- |
| `api_key`     | _str._ Your API key's secret.                                                                         | `GOOMZO_API_KEY`            |
| `max_retries` | _int._ How many times a failed request is tried again.                                                | `2`                         |
| `timeout`     | _float._ Seconds to wait for each try.                                                                | `60.0`                      |
| `base_url`    | _str._ Where the API is.                                                                              | `https://api.goomzo.africa` |
| `http_client` | _httpx.Client._ Your own client, such as for a proxy or tests. `httpx.AsyncClient` for `AsyncGoomzo`. | A new one                   |

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

## Close the client

The client keeps connections open to reuse them. Close it when you're done, or use it as a context manager:

```python
with Goomzo() as goomzo:
    goomzo.messages.send_one({'to': '+255712345678', 'channel': 'sms', 'content': {'text': 'Hi'}})

async with AsyncGoomzo() as goomzo:
    ...
```

## Idempotency keys

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

```python
goomzo.messages.send_one(
    {'to': '+255712345678', 'channel': 'sms', 'content': {'text': 'Your order is ready.'}},
    idempotency_key='order-1042-ready',
)
```

## API version

The SDK sends the `Goomzo-Version` it was written for, as `API_VERSION`:

```python
from goomzo import API_VERSION
```

## Next steps

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

---

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