OOmnistu

Blog / Engineering Playbooks

Engineering Playbooks

API rate limits and spending caps: protecting your backend and your bill

Set API request, resource and spending limits to reduce overload and unexpected third-party service costs.

OOmnistu
Reviewed 2026-11-16 · 2 min read

An API that answers every request without limits can be overloaded, or can run up costs, by one script. OWASP lists this as API4:2023 Unrestricted Resource Consumption (https://owasp.org/API-Security/editions/2023/en/0xa4-unrestricted-resource-consumption/) in its 2023 API Security Top 10.

What can be exhausted

OWASP says satisfying requests uses network bandwidth, CPU, memory and storage, and sometimes paid third-party services such as SMS, email, phone calls or biometric checks, billed per request.

OWASP's limit checklist

OWASP says an API is vulnerable if at least one of these limits is missing or set inappropriately:

Three scenarios from OWASP

  1. Paid SMS flow. A "forgot password" API triggers a third-party SMS at a stated $0.05 per call. An attacker scripts tens of thousands of calls and, in OWASP's scenario, the company loses thousands of dollars in minutes.
  2. GraphQL batching. A per-endpoint rate limit and a file-size check are bypassed by sending hundreds of upload operations in one request, exhausting server memory.
  3. Cloud bill. A file grows beyond a cache's 15 GB limit, every client pulls it directly, and with no cost alerts or maximum cost allowance, the monthly bill rises from about $13 to $8k in OWASP's example.

These are OWASP's illustrations, not Omnistu client cases.

OWASP'S GRAPHQL BATCHING SCENARIO, ANNOTATED One POST /graphql hundreds of upload operations batched inside WHAT THE RATE LIMITER SEES 1 request - within the limit per-endpoint count passes WHAT THE SERVER EXECUTES op op op x hundreds Hundreds of uploads run server memory exhausted The per-request file-size check sees one envelope, not the operations inside it. OWASP'S GRAPHQL BATCHING SCENARIO, ANNOTATED One POST /graphql hundreds of upload operations batched inside WHAT THE RATE LIMITER SEES 1 request - within the limit per-endpoint count passes WHAT THE SERVER EXECUTES op op op x hundreds Hundreds of uploads run server memory exhausted The per-request file-size check sees one envelope, not the operations inside it.
One of OWASP's three resource-exhaustion scenarios: the limiter counts requests while the server executes batched operations - the check and the work run at different granularity.

How OWASP says to prevent it

Questions for your developer

  1. Which of the limits above exist today, and what are their values?
  2. Do our SMS, email and AI provider accounts have spending limits or billing alerts?
  3. Can one request trigger many expensive operations?
  4. Is there a cap on page size?

Limits

This is OWASP's guidance for one risk category. We did not research rate-limiting tools or specific cloud services, and give no recommended numbers because they depend on your product.

By Omnistu.

Sources

Previous
API design basics for mobile apps: methods, retries and safe failure