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

# How it works

> What happens to a request, and the rules every endpoint follows.

You send requests to the gateway, and we route them to a licensed broker, which places orders on the Nigerian Exchange. We store each order before we send it to the exchange, and we send it only once.

| Concept        | What to know                                                                                                                                                                                           |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Authentication | Send your API key in the `Authorization` header as `Bearer $KEY`. Sandbox keys start with `mgw_test_` and live keys start with `mgw_live_`. Each key works only in its own environment.                |
| Amounts        | All amounts are integers in kobo, the smallest unit of the naira. For example, `47500` is ₦475.00.                                                                                                     |
| Idempotency    | Requests that create an order, an application or an allocation require an `Idempotency-Key` header. If you retry a request with the same key, you get the original result back instead of a duplicate. |
| Errors         | Every error has the same JSON shape. Use the `code` field in your logic. The `message` field is written for people and can change. See the [error reference](/errors).                                 |
| Events         | Each change to an order creates an event. List events with `GET /v1/events`, or receive them at your webhook endpoint. See [Webhooks](/webhooks).                                                      |

To go further, read about [orders](/orders), [idempotency](/idempotency), your [wallet](/wallet) and [webhooks](/webhooks).

<Note>
  The sandbox has its own host and its own API keys. It uses test money and doesn't connect to the exchange.
</Note>
