Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages

Help for owners

Someone is hammering or scraping my API and I need limits

Short answer

Without limits, one script can use the same server and database as all your customers together. Rate limiting caps how often a client may call, with stricter limits on sensitive actions such as login and code requests. OWASP lists missing limits as a top API risk. Add them in steps, with monitoring, so real users are not blocked.

  • Written for business owners
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Does this sound like your situation?

  • My API slows down or falls over at odd hours for no clear reason.
  • Someone is copying my whole catalogue, prices or listings.
  • The cloud or hosting bill spiked without matching customer growth.
  • The same address appears thousands of times in the logs.
  • My developer says there is nothing to stop one user sending any number of requests.

Why does this happen?

  1. Every request uses real resources

    OWASP says satisfying API requests takes network bandwidth, CPU, memory and storage. Missing limits can lead to denial of service through resource starvation and can raise operating costs.

  2. Nobody sets limits at launch

    A new API has few users and works fine. The limit is a feature nobody asks for until the day a script finds it.

  3. Some actions need stricter limits than others

    OWASP's advice is to restrict how often a client can call in a timeframe, and to use stricter rules for sensitive endpoints such as OTP validation or password recovery. It also advises limits on payload size and records per request.

  4. A limit with no monitoring blocks the wrong people

    Customers behind one office or mobile network can share an address. A blunt rule per address can lock them out, so rules need tuning against real traffic.

What can I do about it today?

  1. Do not block countries or addresses at randomYou may lock out real customers. Ask for the traffic pattern first.
  2. Ask your developer for a one-page traffic summaryWhich endpoints get the most calls, from how many addresses, and at what times.
  3. Set a billing alert with your cloud providerIt will not stop abuse but it stops a surprise.
  4. Keep a record of the incidentTimes, symptoms and bills. It helps pick the right limits.
  5. Decide what must stay openWhich parts of the API real customers use heavily. Limits are set around that.

When should I bring someone in?

  • Customers are being affected by slowness or errors right now.
  • Your data is being copied at scale.
  • A single client appears to be causing the cost.

How do I handle it?

  1. Measure normal use firstFrom logs I work out how often a real user calls each endpoint, so limits sit above that.
  2. Add limits in layersA general limit at the edge or the web server, and stricter ones on login, signup, code requests and search.
  3. Bound what one request can ask forMaximum page size, upload size and number of items per call.
  4. Roll out in a watch-only mode firstLimits are logged before they block, so I see who would have been stopped and adjust.
  5. Return a clear error and alert meBlocked clients get a standard 'too many requests' answer, and spikes alert you instead of surprising you.

The price depends on what I find, so I quote in writing after a short discovery call. Tell me what is happening and I reply within 24 hours.

What do owners ask about this?

Will rate limiting stop scraping completely?

No. It slows it down and makes it expensive. A determined scraper can spread requests across many addresses, so I combine limits with checks on who is calling.

Can limits break my own app?

Only if set wrongly. That is why I watch real traffic first and roll out in log-only mode before enforcing.

What is an OWASP API risk?

OWASP is an open security community. It publishes a list of the most common API risks. Unrestricted resource consumption is one of them.

Is this about a third-party API like OpenAI?

No. If an outside service is refusing your requests, see the fix page on that error. This page is about limits on your own API.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Found a mistake? Tell me.

For your developer: the technical fixes

Next step

Want this off your desk?

Send me a few lines on where things stand. I reply within 24 hours.