Developers

Rate limits

DevelopersRate limits

Every endpoint is rate limited per source IP via a sliding 60-second window in Cloudflare KV. The limits are applied by route group (not per route) so a POST /api/public/:slug/bookings and a GET /api/public/:slug/services share the same bucket.

Limits by route group

Defined in apps/api/src/index.ts. Every limit is per source IP, sliding 60-second window in Cloudflare KV.

Route groupLimitWindowNotes
POST /api/auth/login1060sPer IP
POST /api/auth/register560sPer IP
POST /api/customer-auth/login1060sPer IP
POST /api/customer-auth/register560sPer IP
POST /api/customer-auth/forgot-password560sPer IP
/api/public/*3060sPublic booking flow
/api/me/*6060sCustomer self-service
/api/webhooks/*6060sStripe inbound
/api/ai/*3060sOwner AI chat / log / insights / smart-reply
/api/ai-public/*3060sPublic booking assistant chat
/api/businesses, /api/services, /api/staff, /api/bookings, /api/customers, /api/payments, /api/adminnone at the route groupInherits only the global Hono logger. No per-IP KV counter is configured in apps/api/src/index.ts.

How the limiter works

The rateLimit middleware reads cf-connecting-ip and increments a counter in KV under the key {prefix}:{ip}. The counter expires with the window. When the counter would exceed the limit, the request is rejected with HTTP 429 before the handler runs.

429 response

The 429 response is a bare object with the error code as a string:

{
  "error": "rate_limited"
}
Headers actually returned
The current middleware sets only the Retry-After header (in seconds, computed from KV's window-reset timestamp). The X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset headers are NOT set today.

Backoff strategy

  • On 429, wait until Retry-After seconds before retrying.
  • If no Retry-After, wait 60 seconds (default window).
  • Exponential backoff: multiply wait by 2 on each consecutive 429.
  • Cap at 5 minutes between retries.
  • After 5 consecutive 429s, give up and contact support.

How to request a rate limit increase

The route-group limits in the table above are the only limits in the API today — there is no separate per-tier tier multiplier (free / pro / enterprise) wired into the rate limiter. Custom limits per route are not currently exposed. To request a change, contact hello@netwit.ca.

Need a human?

Email hello@netwit.ca or call +1-604-206-8169. NetWit responds in 1 business day.