Skip to main content
Rate limits protect the API from abuse and ensure fair usage for all users.

Limits by Plan

PlanRequests per Minute
Free100
Hobby500
Pro2,000
Limits are applied per API key using a sliding window algorithm.

Rate Limit Headers

Every response includes rate limit information:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1705312800
HeaderDescription
X-RateLimit-LimitMaximum requests allowed 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, you’ll receive a 429 Too Many Requests response:
{
  "error": {
    "code": "rate_limit_exceeded",
    "message": "Rate limit exceeded"
  }
}
The response includes a Retry-After header indicating how long to wait:
Retry-After: 30

Implementation Example

async function uploadWithRetry(file, maxRetries = 3) {
  for (let attempt = 0; attempt < maxRetries; attempt++) {
    const response = await fetch('https://api.stashfyle.com/v1/upload', {
      method: 'POST',
      headers: { 'Authorization': 'Bearer sk_live_xxx' },
      body: file
    });

    if (response.status === 429) {
      const retryAfter = parseInt(response.headers.get('Retry-After') || '60');
      console.log(`Rate limited. Retrying in ${retryAfter}s...`);
      await new Promise(resolve => setTimeout(resolve, retryAfter * 1000));
      continue;
    }

    return response.json();
  }

  throw new Error('Max retries exceeded');
}

Best Practices

Check X-RateLimit-Remaining to proactively slow down before hitting limits.
Instead of retrying immediately, wait progressively longer between retries.
Instead of many small requests, consider batching operations.
For read operations, cache responses to reduce API calls.
Each key has its own rate limit, so separate keys for different services won’t interfere.

Need Higher Limits?

If you’re consistently hitting rate limits, consider upgrading your plan:
FreeHobby ($9/mo)Pro ($29/mo)
Requests/min1005002,000
Upgrade your plan →