Rate Limits

Understand API rate limits and how to handle them.

Overview

Rate limits protect the API from abuse and ensure fair usage. Limits are enforced per API key.

Current Limits

REST API

EnvironmentLimitWindow
Live keys (wk_live_)1,000 requestsPer minute
Test keys (wk_test_)100 requestsPer minute

OAuth Endpoints

EndpointLimitWindow
POST /oauth/token60 requests per IPPer minute
POST /oauth/token30 requests per client_idPer minute
POST /oauth/register10 requests per IPPer hour

OAuth rate limit responses include a Retry-After header (seconds to wait). Implement exponential backoff — see OAuth errors for a code example.

Response Headers

Every API response includes rate limit information:

HeaderDescription
X-RateLimit-LimitMaximum requests per window
X-RateLimit-RemainingRequests remaining in current window
X-RateLimit-ResetUnix timestamp when the window resets

Handling Rate Limits

When you exceed the limit, the API returns 429 Too Many Requests:

{
  "error": {
    "code": "RATE_LIMITED",
    "message": "Rate limit exceeded. Try again in 45 seconds."
  }
}

Exponential Backoff

Implement automatic retries with increasing delays:

async function apiRequest(url, options, maxRetries = 3) {
  for (let attempt = 0; attempt <= maxRetries; attempt++) {
    const response = await fetch(url, options);

    if (response.status !== 429) return response;

    const resetAt = response.headers.get('X-RateLimit-Reset');
    const waitMs = resetAt
      ? (Number(resetAt) * 1000) - Date.now()
      : Math.pow(2, attempt) * 1000;

    await new Promise(resolve => setTimeout(resolve, waitMs));
  }
  throw new Error('Rate limit exceeded after max retries');
}

Best Practices

  1. Cache responses when possible to reduce API calls
  2. Use webhooks instead of polling for real-time data
  3. Batch operations where the API supports it
  4. Monitor your usage via the X-RateLimit-Remaining header
  5. Spread requests over time instead of bursting

On this page