Skip to content
Back

How to bypass the rate limit on the backend calls?

  • 0
  • Databases
  • Web
  • Cloud
martins4
13 May, 2026, 10:05

Once a month my app has a ton of usage and I always run into the Too many requests 429 error.

I am trying to optimize the queues and jobs to manage that, but as the platform is getting more and more users, I am not able to optimize it and running that in enough time.

I have seen I could use the dev api key, to bypass that limit.

Is that a good practice? Or what other options do I have?

Thanks

TL;DR
Developers are encountering rate limit issues on backend calls. They can implement exponential backoff + jitter and retry logic for 429 errors to manage the rate limits effectively. They are considering using the dev API key to bypass the limit and are seeking advice on whether this is a good practice.
martins4
13 May, 2026, 10:11

/**

  • Pace an Appwrite SDK call through the global token bucket. Retries on 429
  • with exponential backoff + jitter, respecting Retry-After / `X-RateLimit-
  • Reset` when present. Any non-429 error is rethrown immediately.
  • Usage:
  • const doc = await withAppwriteCall(() =>
  • TypeScript
    tablesDB.getRow({ databaseId, tableId, rowId })
    
  • )
  • Wrap at the REPO boundary, not at every call site — see the repo files for
  • the canonical pattern. */ export async function withAppwriteCall<T>( fn: () => Promise<T>, opts: WithAppwriteCallOptions = {} ): Promise<T> { const maxRetries = opts.maxRetries ?? MAX_RETRIES const label = opts.label ?? 'appwrite' let attempt = 0

while (true) { const { waitedMs } = await acquireToken() stats.calls += 1 stats.totalWaitMs += waitedMs if (waitedMs > 0) stats.throttleWaits += 1

TypeScript
try {
  return await fn()
} catch (err) {
  if (!isRateLimitError(err)) throw err

  // 429 — apply retry logic.
  stats.rateLimitHits += 1
  if (attempt >= maxRetries) {
    throw new AppwriteThrottleExhausted(
      `[${label}] giving up after ${attempt + 1} attempts on 429`,
      attempt + 1
    )
  }
  stats.retries += 1
  const explicit = readRetryAfter(err)
  const sleepMs = explicit ?? backoffMs(attempt)
  console.warn(
    `[throttle] ${label} 429 attempt=${attempt + 1}/${maxRetries + 1} sleep=${sleepMs}ms (${explicit ? 'retry-after' : 'exponential'})`
  )
  await sleep(sleepMs)
  attempt += 1
  // Loop continues; we'll acquire a fresh token and retry.
}

} } also tryied using this

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more