Skip to main content
Rate Limits:
  • Core Operations: 10,000 requests/minute (login, create/delete user, create/join group)
  • Standard Operations: 20,000 requests/minute (all other operations)
Rate Limit Response:
  • Status Code: 429 (Too Many Requests)
  • Headers: Retry-After, X-Rate-Limit-Reset, X-Rate-Limit, X-Rate-Limit-Remaining
Best Practice: Monitor X-Rate-Limit-Remaining header and implement exponential backoff when approaching limits.
CometChat applies rate limits to REST API requests to ensure fair usage and platform stability. Understanding them 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. Rate limits can be adjusted on a per-need basis depending on your use case and plan.

What Happens When the Rate Limit Is Reached?

The request isn’t processed and a response is sent containing a 429 response code. Along with the response code, a couple of headers are sent that specify the time in seconds you must wait before you can try the request again. Retry-After: 15 X-Rate-Limit-Reset: 1625143246

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)

Rate Limit Endpoint

CometChat does not provide a dedicated rate-limit endpoint. Use the response headers below to monitor your current limit and remaining requests: X-Rate-Limit: 700 X-Rate-Limit-Remaining: 699

Handling Rate Limits

When you exceed the rate limit, CometChat returns HTTP 429 Too Many Requests. Implement exponential backoff to handle this gracefully:
private void callWithRetry(Runnable apiCall, int maxRetries, int attempt) {
    try {
        apiCall.run();
    } catch (Exception e) {
        if (e instanceof CometChatException &&
            ((CometChatException) e).getCode().equals("TOO_MANY_REQUEST") &&
            attempt < maxRetries) {
            long waitTime = (long) Math.pow(2, attempt) * 1000;
            Log.d(TAG, "Rate limited. Retrying in " + (waitTime / 1000) + "s...");
            new Handler(Looper.getMainLooper()).postDelayed(
                () -> callWithRetry(apiCall, maxRetries, attempt + 1),
                waitTime
            );
        } else {
            Log.e(TAG, "Max retries exceeded or non-rate-limit error: " + e.getMessage());
        }
    }
}

Next Steps

Setup

Configure SDK for optimal API usage

Connection Behaviour

Use WebSocket for real-time updates instead of polling

Real-Time Listeners

Receive updates via WebSocket to reduce API calls

REST API Documentation

Explore REST API endpoints and rate limits