Storra Cloud

Rate Limiting

Per-API-key rate limits enforced in src/lib/client-api/rate-limit.ts.

Overview

Each API key has independent buckets. Limits reset on a rolling window per bucket.

Limits by Bucket

BucketLimitWindowRoutes
user_read601 minuteGET /users/me
user_prefs301 minutePATCH /users/me/preferences
upload501 hourPOST /files/upload
list1001 hourGET /files/list, GET /list
download2001 hourGET/HEAD /files/download/{file_id}
folder1001 hourPOST /create-folder, GET /info/{path}
file_ops1001 hourPUT /move, POST /copy-folder, POST /duplicate, PUT /privacy, DELETE /{path}
trash501 hourGET /trash, POST /trash/restore, POST /trash/empty
permissions1001 hourPOST /permissions/grant, GET/PUT/DELETE /permissions/{id}

Response Headers

Every successful client API response includes:

  • X-RateLimit-Limit - max requests in the window
  • X-RateLimit-Remaining - requests left
  • X-RateLimit-Reset - Unix timestamp when the window resets

Handling 429

async function apiWithRetry(fn, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    const res = await fn();
    if (res.status !== 429) return res;
    const retryAfter = Number(res.headers.get("Retry-After") ?? 60);
    await new Promise((r) => setTimeout(r, retryAfter * 1000));
  }
  throw new Error("Rate limit exceeded");
}
Was this page helpful?