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

# Rate Limits

> API rate limits and how to handle 429 responses.

VitaRelay enforces rate limits per API key to ensure platform stability.

## Limits

| Plan       | Requests per minute | Requests per day |
| ---------- | ------------------- | ---------------- |
| Standard   | 60                  | 10,000           |
| Partner    | 300                 | 100,000          |
| Enterprise | Custom              | Custom           |

Rate limits are applied per API key, not per IP address.

## Rate limit headers

Every API response includes headers showing your current limit status:

```text theme={null}
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 47
X-RateLimit-Reset: 1719326400
```

`X-RateLimit-Reset` is a Unix timestamp indicating when the window resets.

## Handling 429 responses

When you exceed the limit, you'll receive a `429 Too Many Requests` response:

```json theme={null}
{
  "error": "rate_limited",
  "message": "Rate limit exceeded. Retry after 2025-06-25T14:33:20Z",
  "retry_after": "2025-06-25T14:33:20Z"
}
```

Implement exponential backoff with jitter:

```typescript theme={null}
async function fetchWithRetry(url: string, options: RequestInit, maxRetries = 3) {
  for (let attempt = 0; attempt <= maxRetries; attempt++) {
    const res = await fetch(url, options);
    
    if (res.status !== 429) return res;
    
    if (attempt === maxRetries) throw new Error("Rate limit — max retries exceeded");
    
    const retryAfter = res.headers.get("Retry-After");
    const waitMs = retryAfter
      ? parseInt(retryAfter) * 1000
      : Math.min(1000 * 2 ** attempt + Math.random() * 1000, 30000);
    
    await new Promise(resolve => setTimeout(resolve, waitMs));
  }
}
```

## Reducing request volume

* **Use webhooks instead of polling.** Register a webhook endpoint for `order.updated` instead of polling `GET /orders` on a timer.
* **Batch where possible.** If you're syncing many patients, consider batching imports rather than creating one at a time.
* **Cache responses.** Resource data that doesn't change frequently (e.g. product catalog) can be cached locally.

## Increasing your limit

Contact [info@vitarelay.com](mailto:info@vitarelay.com) if you need a higher rate limit for a high-volume integration.
