Skip to main content

Rate Limits

The GB Chat API implements rate limiting to ensure fair usage and protect the service from abuse.

Default Limits​

LimitValue
Requests per minute60
ConfigurableYes

Customizing Your Rate Limit​

You can adjust your rate limit in the dashboard:

  1. Go to Settings > Public API
  2. Find the Rate Limit section
  3. Enter your desired requests per minute (1-1000)
  4. Click Save

Rate Limit Headers​

Every API response includes headers to help you track your usage:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 1707300660
HeaderDescription
X-RateLimit-LimitMaximum requests allowed per minute
X-RateLimit-RemainingRequests remaining in current window
X-RateLimit-ResetUnix timestamp when the limit resets

Rate Limit Exceeded​

When you exceed the rate limit, you'll receive a 429 Too Many Requests response:

{
"success": false,
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Too many requests. Please try again later."
}
}

Retry-After Header​

The response includes a Retry-After header indicating when you can retry:

Retry-After: 30

This value is in seconds.

Best Practices​

Implement Exponential Backoff​

When you receive a 429 error, wait before retrying:

async function sendWithRetry(payload, maxRetries = 3) {
for (let attempt = 0; attempt < maxRetries; attempt++) {
try {
const response = await sendMessage(payload);
return response;
} catch (error) {
if (error.status === 429 && attempt < maxRetries - 1) {
const waitTime = Math.pow(2, attempt) * 1000; // 1s, 2s, 4s
await sleep(waitTime);
continue;
}
throw error;
}
}
}

Queue Your Messages​

If you need to send many messages, implement a queue:

const queue = [];
const RATE_LIMIT = 60;
const INTERVAL = 60000 / RATE_LIMIT; // ~1 second between messages

async function processQueue() {
while (queue.length > 0) {
const message = queue.shift();
await sendMessage(message);
await sleep(INTERVAL);
}
}

Monitor Your Usage​

Check the rate limit headers in responses to stay within limits:

function handleResponse(response) {
const remaining = response.headers['x-ratelimit-remaining'];
const reset = response.headers['x-ratelimit-reset'];

if (remaining < 10) {
console.warn(`Low rate limit: ${remaining} requests remaining`);
console.log(`Resets at: ${new Date(reset * 1000)}`);
}
}

Burst Protection​

The rate limiter uses a sliding window algorithm, which means:

  • Limits are calculated over a rolling 60-second window
  • You can't "save up" requests from quiet periods
  • Bursts are smoothed out over the window

Need Higher Limits?​

If you need a higher rate limit for your use case, contact us at support@workmatic.in.