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

# Rate Limiting

> Understand API rate limits and how to handle them

## Rate Limits

The bitbybit Open API enforces rate limits to ensure fair usage and platform stability.

### Current Limits

| Limit                           | Value |
| ------------------------------- | ----- |
| Requests per minute per API key | 100   |

### Rate Limit Headers

Every API response includes standard rate limit headers:

| Header                | Description                                    |
| --------------------- | ---------------------------------------------- |
| `RateLimit-Limit`     | Maximum requests allowed in the current window |
| `RateLimit-Remaining` | Remaining requests in the current window       |
| `RateLimit-Reset`     | Seconds until the rate limit window resets     |

### Handling Rate Limits

When you exceed the rate limit, you'll receive a `429` response:

```json theme={null}
{
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Too many requests. Please retry after the reset period."
  }
}
```

**Recommended retry strategy:**

1. Check the `RateLimit-Reset` header for when to retry
2. Use exponential backoff: wait 1s, then 2s, then 4s, etc.
3. Add random jitter to avoid thundering herd

```javascript theme={null}
async function fetchWithRetry(url, options, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    const response = await fetch(url, options);

    if (response.status === 429) {
      const resetAfter = response.headers.get('RateLimit-Reset') || '60';
      const waitMs = Math.min(parseInt(resetAfter) * 1000, 60000);
      const jitter = Math.random() * 1000;
      await new Promise(resolve => setTimeout(resolve, waitMs + jitter));
      continue;
    }

    return response;
  }
  throw new Error('Max retries exceeded');
}
```
