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

# Rate Limits

> The API allows 100 requests per minute and 5 active API keys per account. Learn how to handle 429 responses with exponential backoff and safe retries.

## Limits

| Limit | Value |
| - | - |
| Requests per minute | **100** |
| Max active API keys per account | **5** |

***

## Rate Limit Response

When you exceed 100 requests per minute, the API returns:

```
HTTP 429 Too Many Requests
```

***

## Handling Rate Limits

Implement **exponential backoff** when you receive a `429` response. Never hammer the API with immediate retries.

```javascript theme={null}
async function purchaseWithRetry(payload, retries = 4) {
  for (let attempt = 0; attempt < retries; attempt++) {
    const res = await fetch('https://api.rapidtopup.com.ng/api/v2/b2b/purchase', {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${process.env.RAPIDTOPUP_API_KEY}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify(payload),
    });

    if (res.status !== 429) return res.json();

    // Wait 2^attempt seconds before retrying (1s, 2s, 4s, 8s)
    const wait = Math.pow(2, attempt) * 1000;
    await new Promise(resolve => setTimeout(resolve, wait));
  }

  throw new Error('Rate limit exceeded after all retries.');
}
```

> [!WARNING]
>
> Never retry a `/purchase` request purely because of a `429` error without checking the transaction status first via `/requery`. A `429` can arrive *after* the transaction was already processed.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.