Rate Limiting
CubeConnect enforces rate limits to ensure platform stability. Limits are applied per tenant and vary based on your subscription plan.
Rate Limit Headers
Every API response includes rate limit information:
http
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 58| Header | Description |
|---|---|
X-RateLimit-Limit | Maximum requests allowed per window |
X-RateLimit-Remaining | Remaining requests in the current window |
Plan Limits
Rate limits are determined by your subscription plan:
| Plan | Requests per Minute |
|---|---|
| Free | 10 |
| Starter | 30 |
| Professional | 60 |
| Enterprise | 120+ |
TIP
Contact support to request custom rate limits for high-volume use cases.
Rate Limit Exceeded
When you exceed the rate limit, the API returns a 429 status code:
json
{
"success": false,
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Rate limit exceeded for your current plan."
}
}Billing-Related Limits
In addition to per-minute rate limits, the API may return 429 for billing-related restrictions:
| Error Code | Description |
|---|---|
RATE_LIMIT_EXCEEDED | Too many requests per minute |
PLAN_LIMIT_REACHED | Monthly message quota exhausted |
SUBSCRIPTION_EXPIRED | Subscription has expired — renew to continue |
json
// Plan limit reached
{
"success": false,
"error": {
"code": "PLAN_LIMIT_REACHED",
"message": "You have reached the message limit for your current plan."
}
}
// Subscription expired
{
"success": false,
"error": {
"code": "SUBSCRIPTION_EXPIRED",
"message": "Your subscription has expired."
}
}Best Practices
- Implement exponential backoff — When receiving a
429, wait before retrying and increase the wait time with each retry - Queue messages — Instead of sending messages in rapid succession, use a message queue
- Monitor usage — Track your
X-RateLimit-Remainingheader to avoid hitting limits - Batch operations — Where possible, reduce the total number of API calls
Example: Exponential Backoff
javascript
async function sendWithRetry(payload, maxRetries = 3) {
for (let attempt = 0; attempt < maxRetries; attempt++) {
const response = await fetch('https://cubeconnect.io/api/v1/messages/send', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify(payload),
})
if (response.status !== 429) return response
const waitTime = Math.pow(2, attempt) * 1000
await new Promise(resolve => setTimeout(resolve, waitTime))
}
throw new Error('Rate limit exceeded after max retries')
}