Skip to main content
  • Core Operations (login, create/delete user, create/join group): 10,000 requests/min cumulative
  • Standard Operations (all other): 20,000 requests/min cumulative
  • Rate-limited responses return HTTP 429 with Retry-After and X-Rate-Limit-Reset headers
  • Monitor usage via X-Rate-Limit and X-Rate-Limit-Remaining response headers
CometChat applies rate limits to ensure fair usage and platform stability. Understanding these limits helps you build applications that handle high traffic gracefully.

Rate Limit Tiers

Operation TypeLimitExamples
Core Operations10,000 requests/minLogin, create/delete user, create/join group
Standard Operations20,000 requests/minAll other operations
Rate limits are cumulative within each tier. For example, if you make 5,000 login requests and 5,000 create user requests in one minute, you’ve hit the 10,000 core operations limit.

Response Headers

CometChat includes rate limit information in response headers:
HeaderDescription
X-Rate-LimitYour current rate limit
X-Rate-Limit-RemainingRequests remaining in current window
Retry-AfterSeconds to wait before retrying (on 429)
X-Rate-Limit-ResetUnix timestamp when limit resets (on 429)

Handling Rate Limits

When you exceed the rate limit, CometChat returns HTTP 429 Too Many Requests. Implement exponential backoff to handle this gracefully:
async function callWithRetry(apiCall, maxRetries = 3) {
  for (let attempt = 0; attempt < maxRetries; attempt++) {
    try {
      return await apiCall();
    } catch (error) {
      if (error.code === "ERR_TOO_MANY_REQUESTS" && attempt < maxRetries - 1) {
        const waitTime = Math.pow(2, attempt) * 1000; // 1s, 2s, 4s
        console.log(`Rate limited. Retrying in ${waitTime / 1000}s...`);
        await new Promise((resolve) => setTimeout(resolve, waitTime));
      } else {
        throw error;
      }
    }
  }
}

// Usage
const users = await callWithRetry(() =>
  new CometChat.UsersRequestBuilder().setLimit(30).build().fetchNext()
);

Tips for Staying Within Limits

  • Batch operations — Space out bulk operations over time instead of firing all at once
  • Monitor headers — Check X-Rate-Limit-Remaining to proactively slow down before hitting limits
  • Avoid frequent login/logout — Core operations share a lower limit; minimize login cycles
  • Use pagination — Fetch data in reasonable page sizes (30-50 items) rather than requesting everything at once
Rate limits can be adjusted based on your use case and plan. Contact CometChat support if you need higher limits.

Next Steps

Setup SDK

Install and configure the CometChat JavaScript SDK

Key Concepts

Learn the core concepts behind CometChat