> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rach.finance/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> Authenticate server-to-server with your API key.

All Rach service endpoints authenticate with an **API key** sent in the `X-API-Key`
header. Use the [right key for the right product](/guides/api-keys) — Payments
(`test_sk_` / `live_sk_`) and CaaS (`rach_sk_*`) keys are not interchangeable.

<Warning>
  Send API keys only from your **backend**. Never expose them in a browser or mobile client.
</Warning>

## Payments

```bash theme={null}
curl https://api.rach.finance/api/v1/wallet/customers \
  -H "X-API-Key: live_sk_your_key" \
  -H "Content-Type: application/json" \
  -d '{ "customer_id": "cust_001" }'
```

## CaaS

```bash theme={null}
curl https://api.rach.finance/caas/api/v1/users/balance?phone_number=+2348010000001 \
  -H "X-API-Key: rach_sk_live_your_key"
```

The **prefix decides the environment** — `test_*` runs in sandbox, `live_*` in production.
See [Test vs Live](/guides/environments).

## Auth errors

| Code  | Meaning                                      | Fix                                                               |
| ----- | -------------------------------------------- | ----------------------------------------------------------------- |
| `401` | Missing / invalid / wrong-product key        | Check the `X-API-Key` header and that the key matches the product |
| `403` | Key valid but not permitted for the resource | —                                                                 |

See [Errors](/guides/errors).
