Skip to main content
← Back to API Reference

Rate Limiting Guide

Understand limits, headers, and production throttling strategies

API Reference
Rate Limits
Production

Understanding Rate Limits

How WAVE counts and enforces API request limits

WAVE uses a sliding window algorithm to track API usage. Each request is counted against your tier's limit for the current 60-second window.

Sliding Window

Your limit resets continuously, not at fixed intervals. If you make 60 requests at 12:00:00, you can make another at 12:01:00 (60 seconds later).

Burst Allowance

Pro tier allows short bursts above the per-minute rate. You can send 50 requests instantly, then throttle to the sustained rate.

Free

60
per 1 minute
Concurrent5
Burst10
60 requests per minute
5 concurrent connections
Basic rate limit headers
Community support

Pro

300
per 1 minute
Concurrent25
Burst50
300 requests per minute
25 concurrent connections
Advanced rate limit headers
Email support
Burst allowance: 50 requests

Enterprise

Unlimited
No limit
Concurrent100
BurstUnlimited
Unlimited API requests
100+ concurrent connections
Custom rate limit configuration
Dedicated support engineer
SLA guarantees

Rate Limit Headers

Track your API usage with response headers

Every API response includes headers showing your current rate limit status:

HTTP/1.1 200 OK
X-RateLimit-Limit: 300
X-RateLimit-Remaining: 247
X-RateLimit-Reset: 1635724800
X-RateLimit-Window: 60
Retry-After: 45
X-RateLimit-Limit

Maximum number of requests allowed in the current window

X-RateLimit-Remaining

Number of requests remaining in the current window

X-RateLimit-Reset

Unix timestamp when the rate limit window resets

Retry-After

Seconds to wait before retrying (only present on 429 errors)

Handling 429 Errors

Production-grade retry strategies

import { WaveClient } from '@wave/api-client';

const client = new WaveClient({
  apiKey: 'wave_live_xxxxx',
  retryOn429: true,
  maxRetries: 3
});

// Manual rate limit handling
async function createStreamWithRetry() {
  try {
    return await client.streams.create({
      title: 'My Stream'
    });
  } catch (error) {
    if (error.status === 429) {
      const retryAfter = parseInt(error.headers['retry-after'] || '60');
      console.log(`Rate limited. Retry after ${retryAfter}s`);

      await sleep(retryAfter * 1000);
      return createStreamWithRetry(); // Retry
    }
    throw error;
  }
}

// Pre-emptive throttling
import { RateLimiter } from 'limiter';

import { DesignTokens, getContainer, getSection } from '@/lib/design-tokens';
const limiter = new RateLimiter({
  tokensPerInterval: 60,
  interval: 'minute'
});

await limiter.removeTokens(1);
const stream = await client.streams.create({ title: 'My Stream' });

Best Practices

Optimize API usage and avoid rate limits

1. Cache Responses

Cache API responses locally (Redis, memory) to reduce redundant requests.

Cache-Control: max-age=300, must-revalidate

2. Batch Requests

Use pagination and filtering to fetch multiple resources in a single request instead of individual calls.

GET /v1/streams?limit=100&status=live,idle

3. Implement Exponential Backoff

On rate limit errors, wait longer between each retry attempt (1s, 2s, 4s, 8s...).

delay = min(2^attempt * 1000, 30000) // Max 30s

4. Monitor Usage

Track X-RateLimit-Remaining and alert when it drops below 20%.

if (remaining < limit * 0.2) { alert('Low rate limit') }

5. Use Webhooks

Instead of polling for status updates, use webhooks to receive real-time notifications.

→ Learn about webhooks
Rate Limiting Guide - API Reference | WAVE Docs | WAVE