> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://esendex.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://esendex.ferndocs.com/_mcp/server.

# Authentication

The Esendex API authenticates every request with an API key passed in the `X-API-Key` header. Requests without a valid key are rejected.

```bash
curl http://gateway-api.e97e9e55a5d242f9a139.uksouth.aksapp.io/v2/balance \
  -H "X-API-Key: $ESENDEX_API_KEY" \
  -H "AccountReference: EX0000000"
```

> **Warning**
>
> Keep your API key secret. Don't embed it in client-side code or commit it to source control — load it from an environment variable or a secrets manager instead.

## Account reference

Many endpoints operate on a specific account and take an `AccountReference` header (or an `accountReference` body field when sending messages). Use the account reference shown in your Esendex account for the account you want to send from, bill against or query.

| Header             | Required           | Description                                                                                     |
| ------------------ | ------------------ | ----------------------------------------------------------------------------------------------- |
| `X-API-Key`        | Always             | Your API key.                                                                                   |
| `AccountReference` | Endpoint-dependent | The account the request applies to. Check each endpoint in the [API Reference](/api-reference). |

## Try it in the API Explorer

Every endpoint in the [API Reference](/api-reference) has a **Try it** button. Enter your API key once and it's reused across endpoints for the rest of your session.