Skip to main content
The MeepaChat API rate-limits requests per IP address to prevent abuse and ensure fair resource usage.

Limits

Two limiters are in effect: Auth endpoints have the stricter limiter applied on top of the global one to reduce brute-force risk.

Algorithm

Both limiters use a token bucket:
  • Each IP starts with a full bucket
  • One token is consumed per request
  • Tokens refill at the configured rate
  • When the bucket is empty, the request is rejected
Global limiter example: a client can send 60 requests instantly (burst), then sustain 4 requests per second, or spread 240 requests evenly over a minute.

Rate limit response

When a limit is exceeded the server returns: Status: 429 Too Many Requests Header: Retry-After: 1
There are no X-RateLimit-* headers. The Retry-After: 1 value is fixed at 1 second regardless of how depleted the bucket is.

IP detection

By default the limiter uses the TCP RemoteAddr. Forwarded headers (X-Forwarded-For, X-Real-IP) are only trusted when the request comes from a configured trusted proxy CIDR, preventing IP spoofing. Configure trusted proxies via the TRUSTED_PROXIES environment variable (comma-separated CIDRs):
When RemoteAddr is within a trusted CIDR, the leftmost IP in X-Forwarded-For (or X-Real-IP) is used as the client IP.

Exemptions

Handling 429 responses

Exponential backoff

Client-side throttling

Spread requests proactively to stay under the limit rather than reacting to 429s:

Prefer WebSocket over polling

For real-time updates, always use the WebSocket connection instead of polling. Polling burns through rate-limit budget and delivers slower updates.

Production tuning

For high-traffic deployments, consider implementing a Redis-backed distributed rate limiter for multi-instance setups.