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

# API Reference

> All NGN Market API endpoints.

The NGN Market API provides programmatic access to Nigerian Exchange Group (NGX) market data. All endpoints share a common base URL, authentication scheme, and response envelope.

<CardGroup cols={3}>
  <Card title="Market" icon="chart-line" href="/api-reference/market/snapshot">
    Snapshots, ASI, top trades, gainers, sector rotation
  </Card>

  <Card title="Companies" icon="building" href="/api-reference/companies/list">
    Profiles, price charts, and financial statements
  </Card>

  <Card title="Forex & Indices" icon="money-bill-wave" href="/api-reference/forex/current">
    NGN exchange rates and all NGX market indices
  </Card>
</CardGroup>

## Base URL

```
https://api.ngnmarket.com/v1
```

## Authentication

Every endpoint except `/health` requires a Bearer token in the `Authorization` header:

```
Authorization: Bearer ngm_live_YOUR_KEY
```

<CodeGroup>
  ```bash curl theme={null}
  curl https://api.ngnmarket.com/v1/market/snapshot \
    -H "Authorization: Bearer ngm_live_YOUR_KEY"
  ```

  ```javascript JavaScript theme={null}
  const res = await fetch('https://api.ngnmarket.com/v1/market/snapshot', {
    headers: { 'Authorization': 'Bearer ngm_live_YOUR_KEY' }
  });
  const data = await res.json();
  ```

  ```python Python theme={null}
  import requests

  res = requests.get(
    'https://api.ngnmarket.com/v1/market/snapshot',
    headers={ 'Authorization': 'Bearer ngm_live_YOUR_KEY' }
  )
  data = res.json()
  ```
</CodeGroup>

Get your key from the [developer dashboard](https://ngnmarket.com/developer).

<Warning>
  Never expose your API key in client-side code or commit it to version control. If a key is compromised, revoke it from the dashboard immediately.
</Warning>

## HTTP Response Codes

|  Code | Meaning                                                                       |
| :---: | :---------------------------------------------------------------------------- |
| `200` | Request succeeded                                                             |
| `401` | Missing or invalid API key                                                    |
| `403` | Endpoint requires a higher plan, or request IP is not in this key's allowlist |
| `404` | Resource or route not found                                                   |
| `429` | Monthly quota exceeded                                                        |
| `500` | Unexpected server error                                                       |

## Response Envelope

Every response (success or error) uses the same JSON envelope:

```json theme={null}
{
  "success": true,
  "data": { },
  "meta": {
    "plan": "starter",
    "calls_used": 4821,
    "calls_remaining": 95179,
    "reset_at": "2026-05-01T00:00:00.000Z"
  }
}
```

The `meta` object is included on every response so you always know where you stand on your quota.
