Rate-Limit Decision Matrix

Start with one API route and the work you need to protect. An export endpoint might need a limit on jobs started by each authenticated partner, while a public search endpoint might need a limit that protects the database from bursts. Write down what you will count, who shares the counter, the time window and what clients receive when they exceed it.

Choose the key according to who should share a budget. Several clients can share one office or mobile IP address. Conversely, one partner integration may send requests from many addresses. Where you have authenticated client information, use it to scope the budget to that integration.

Start with the route

Different routes deserve different limits:

Route type Example risk Typical decision
Login Credential stuffing, password spraying, account enumeration Count failures, challenge, throttle, or block by risk context
Password reset Inbox flooding, recovery abuse, account takeover setup Lower thresholds, monitor target account, delay risky follow-up actions
Search or catalogue Scraping, expensive origin work Limit by route, fingerprint, query pattern, and client class
Checkout or payout Fraud, carding, inventory abuse, money movement Combine account, device, session, payment, and network evidence
API export Data exfiltration, partner misuse Limit by token, account, route, data volume, and time window
Admin or configuration Privilege abuse, lateral movement Require strong auth, strict thresholds, and reviewable evidence

The same request volume can be normal on one route and suspicious on another.

Choose the right keys

Useful keys can include:

  • IP address
  • Account ID or user ID
  • Session ID
  • Authenticated API client or credential identifier
  • Device or browser fingerprint
  • TLS or HTTP/2 fingerprint
  • ASN, country, or network category
  • Header or cookie value
  • Response outcome
  • Route, method, or action
  • Tenant, partner, or organisation

Keys can be combined. For example, counting export starts by authenticated client and route lets you cap that operation independently of the same client’s ordinary reads. Use a stable identifier for reporting and keep raw credentials out of logs.

Match action to confidence

Rate limits should not jump straight to permanent blocking. Common actions include log, alert, throttle, challenge, delay, temporary block, hard block, or review. The right choice depends on the route, evidence strength, business value, and false-positive cost.

A low-confidence signal on a public product route may only need logging. The same signal on password reset, payout, data export, or API-key creation may justify stronger friction.

Work through an API export limit

  1. Define the budget. On an export-start route, count new jobs against the authenticated client. If all clients in a tenant share the same backend capacity or allowance, consider a separate tenant budget. Treat status polling and retries according to the work they actually trigger.
  2. Observe a normal busy period. Compare requests that would exceed the proposed limit with normal scheduled exports and retry traffic. Check queue depth and job completion to see whether the threshold addresses the actual bottleneck.
  3. Test the client response. When enforcing a request limit, return HTTP 429 Too Many Requests. If you provide Retry-After, verify that clients wait before retrying. Exercise both an over-limit request and a normal export with a client you control. See RFC 6585, section 4.
  4. Verify the result and keep a rollback. Compare legitimate export completion and queue depth with the observation period. Keep a way to return this route to logging if expected exports start failing.

Keep the evidence visible

Operators need to know:

  • Which rule fired
  • Which key was counted
  • Which route and method were involved
  • What action was taken
  • How many legitimate users were affected
  • Whether origin pressure, fraud, or account abuse changed

Without that feedback, rate limiting becomes guesswork. With it, teams can tune thresholds, split noisy routes, lower false positives, and identify when attackers have moved to another path.

For Peakhour configuration, follow the advanced rate limiting tutorial. If you are limiting failed logins, see Protect a Sign-In Route for an example that counts response outcomes.

© PEAKHOUR.IO PTY LTD 2026   ABN 76 619 930 826    All rights reserved.