Skip to main content

Rate Limiting

Protect your backend APIs from abuse, excessive load, and DDoS attacks with KnoxCall’s intelligent rate limiting system.

What is Rate Limiting?

Rate limiting controls how many requests a client can make within a specific time window. It prevents:
  • API abuse - Malicious users making excessive requests
  • Accidental overload - Buggy code creating infinite loops
  • DDoS attacks - Distributed denial of service attempts
  • Cost overruns - Preventing excessive API usage costs

How Rate Limiting Works

Rate limit counters reset based on your configured window:
  • Per minute: Resets every 60 seconds
  • Per hour: Resets every hour
  • Per day: Resets at midnight UTC

Configuration Levels

KnoxCall supports rate limiting at multiple levels (applied in order):

1. Tenant-Level Limits (Account-Wide)

First checkpoint: Total requests across entire tenant
How it works:
  • Token bucket algorithm (allows bursts)
  • Refills continuously based on your plan tier
  • Applied before route or client limits
  • Automatic based on subscription plan
Plan Tiers:
Use case: Platform-wide protection, billing enforcement, abuse prevention Token bucket behavior:
Benefits:
  • ✅ Allows traffic bursts (better UX than strict limits)
  • ✅ Still protects against sustained abuse
  • ✅ Industry standard for API gateways

2. Route-Level Limits

Second checkpoint: Limits per route
Use case: Protect specific backend APIs from overload

3. Client-Level Limits

Third checkpoint: Limits per client
Use case: Fair usage per client/application, prevent single client from monopolizing resources

4. Method-Specific Limits

Fourth checkpoint: Different limits per HTTP method
Use case: Restrict write operations more than reads

How Limits Stack

Request passes through ALL levels in order:
If ANY limit exceeded → 429 Too Many Requests

Setting Up Rate Limits

Route-Level Rate Limiting

  1. Navigate to Routes → Select your route
  2. Scroll to Rate Limiting section
  3. Toggle Enable Rate Limiting to ON
  4. Configure limits:
Request Limit:
Time Window:
Options: minute, hour, day Burst Allowance (Optional):
Allows temporary spikes above the base limit.
  1. Click Save

Client-Level Rate Limiting

  1. Navigate to Clients → Select your client
  2. Scroll to Rate Limiting section
  3. Configure limits:
Per-Client Limit:
Applies to: All routes this client can access

Method-Specific Rate Limiting

  1. Edit your route
  2. Go to Method Configurations tab
  3. For each HTTP method, set individual limits:

Rate Limit Response

When a client exceeds the limit, they receive: HTTP Status:
Response Headers:
Response Body:

Checking Rate Limit Status

Clients can check their current status via response headers on every request:
Headers:
  • X-RateLimit-Limit: Total requests allowed in window
  • X-RateLimit-Remaining: Requests remaining in current window
  • X-RateLimit-Reset: Unix timestamp when limit resets

Monitoring Tenant-Level Limits

Dashboard view: Navigate to AccountUsage to see your tenant-wide rate limit status:
API endpoint: Current tenant-level rate limit usage is visible in GET /v1/account/usage — see the Account API reference. When to upgrade:
  • ⚠️ Consistently using >80% of tokens
  • ⚠️ Seeing 429 errors in logs
  • ⚠️ Traffic growing month-over-month
  • ⚠️ Planning marketing campaign or launch
Upgrade options:

Burst Protection

Handle temporary traffic spikes without blocking legitimate users: Configuration:
How it works:
  • Client can make up to 1,200 requests in a short burst
  • After burst, limited to 1,000 requests/hour average
  • Prevents legitimate spikes from being blocked
Example:

Advanced Strategies

Per-User Rate Limiting

Use different limits based on user tiers:
Create separate clients for each tier.

Geographic Rate Limiting

Combine with IP whitelisting:
Create region-specific clients with different limits.

Time-Based Rate Limiting

Different limits for peak vs off-peak: Peak Hours (9 AM - 5 PM):
  • Limit: 500 requests/hour
Off-Peak:
  • Limit: 2,000 requests/hour
This requires creating separate routes or using API-based dynamic configuration.

Rate Limit Monitoring

View Rate Limit Events

  1. Navigate to LogsAPI Logs
  2. Filter by status code: 429
  3. See which clients are hitting limits

Set Up Alerts

Get notified when clients hit rate limits:
  1. Navigate to AlertsAdd Alert
  2. Select Rate Limit Exceeded
  3. Configure:

Analytics Dashboard

Monitor rate limit metrics:
  • Hit rate: % of requests that are rate-limited
  • Top offenders: Clients hitting limits most often
  • Trend analysis: Rate limit violations over time

Best Practices

1. Start Conservative

Begin with strict limits and relax based on usage:

2. Use Tiered Limits

Different limits for different client types:

3. Enable Burst Protection

Allow temporary spikes:

4. Monitor and Adjust

  • Check rate limit logs weekly
  • Adjust limits based on legitimate usage
  • Set alerts for unusual patterns

5. Communicate Limits

Document your rate limits for API consumers:

Common Configurations

Webhook Endpoint

Public API

Internal Microservices

Payment Processing

Handling Rate Limits (Client-Side)

Exponential Backoff

When receiving 429, implement retry logic:

Check Headers Proactively

Request Queuing

Prevent hitting limits by queuing requests:

Troubleshooting

High False Positive Rate

Problem: Legitimate users hitting limits Solutions:
  • Increase burst allowance
  • Raise base limits
  • Use per-user instead of per-IP limits

DDoS Still Getting Through

Problem: Rate limits not preventing attacks Solutions:
  • Lower limits for unknown clients
  • Enable request signing
  • Use IP-based blocking
  • Contact support for enterprise DDoS protection

Inconsistent Limit Enforcement

Problem: Some requests bypass rate limits Check:
  • Rate limits enabled on all routes
  • No conflicting client configurations
  • Limits applied at correct level (route vs client)

Next Steps

Request Signing

Add cryptographic signatures for extra security

Alerts

Get notified of rate limit violations

Analytics

Monitor rate limit metrics

Client Management

Set up per-client limits

📊 Statistics

  • Level: intermediate
  • Time: 15 minutes

🏷️ Tags

rate-limiting, security, ddos, api-protection