Skip to content
Glossary

What is rate limiting?

The cheapest defense against abuse, runaway scripts and a surprise bill from your AI provider.

Updated October 24, 2026Sources checked October 24, 20264 min readHow we check our content

In short

Rate limiting is a control that caps how many requests a user, API key or IP address can make in a set period, such as 100 per minute, and refuses the rest; slowing them instead is called throttling. It protects an app from abuse, brute-force logins, runaway scripts and unexpected bills.

Also called: Request limits

Who hits a public app that has no rate limiting?

Scripts and bots, long before most real users. A public app meets scripts that try thousands of passwords, bots that fill forms, and, if it calls an AI model, anyone who works out that each request costs you money. OWASP lists unrestricted resource consumption among the top ten API security risks.

OWASP's own example is a text message that costs $0.05 to send: an attacker who repeats the request tens of thousands of times can cost the owner thousands of dollars in minutes. Anything paid per request, such as email, SMS or an AI call, has the same shape. Our article on a Supabase bill that suddenly jumped covers how that looks from the invoice side.

Which endpoints and calls need a rate limit first?

Start with the endpoints an attacker or a bot gains most from: sign-in, sign-up and password reset; anything that sends email or SMS; every call to a paid API, especially AI models; and any request that can ask for unlimited data. Limit each by user, and by IP address where it helps:

  • Sign-in, sign-up and password reset, by account and by IP address.
  • Anything that sends email or SMS.
  • Every call to a paid API, especially AI models, by user and in total.
  • Any request that can ask for unlimited data: OWASP also recommends capping page sizes and upload sizes on the server.

For sign-in, NIST's authentication guidelines set a ceiling: no more than 100 consecutive failed attempts on one account before it is disabled. To avoid locking out real people sooner, they suggest a bot-detection challenge or a wait after each failure that grows as the limit nears, for example from 30 seconds to an hour.

What should an app return when a rate limit is hit?

The HTTP status 429 Too Many Requests, defined in RFC 6585 for exactly this case, ideally with a Retry-After header saying how long to wait. The RFC's own example allows 50 requests per hour per signed-in user and answers the 51st with a 429 and Retry-After: 3600, one hour. Well-behaved clients read that header and back off.

How do you add rate limiting to a Lovable or Supabase app?

On the server, never only in the browser, since anyone can call your endpoints directly. In practice that means the check lives in the edge function or API route that does the expensive work, counted per user and per IP address, with a total cap above both. The Lovable security checklist lists it alongside the other public-launch checks.

  1. List every endpoint that sends something, costs money or checks a password.
  2. Put a per-user and per-IP limit on each, answering 429 with Retry-After.
  3. Set spending limits with every paid provider, as OWASP recommends, or billing alerts where a limit is not offered.
  4. Log refusals, so you can tell an attack from a limit set too low.

Our guide to adding OpenAI to a Lovable app covers where those checks go, and rate limits are one of the questions in the production readiness check.

Common questions

What is the difference between rate limiting and throttling?

Rate limiting refuses requests over the limit; throttling slows them down. Many systems do both. Either way, the limit applies per user, API key or IP address over a set period, such as 100 requests per minute, so one heavy user cannot slow the app for everyone else.

What HTTP status code means you have been rate limited?

429 Too Many Requests, defined in RFC 6585 in April 2012. It means the client has sent too many requests in a given amount of time. The response may include a Retry-After header saying how long to wait before trying again; the RFC's example uses 3600 seconds.

How many failed login attempts should an app allow?

NIST's guidelines cap it at no more than 100 consecutive failed attempts on one account, and lower limits are allowed. To protect real users from lockouts, NIST suggests bot-detection challenges or waits that grow after each failure, such as from 30 seconds up to an hour.

Does rate limiting protect against a surprise AI bill?

Partly. A per-user limit stops one account from making thousands of calls, but many accounts can still add up. OWASP recommends configuring spending limits with every paid provider as well, or billing alerts where a provider offers no limit, so a total cap sits above the per-user ones.

Go deeper

Lovable OpenAI integration: keep your key safe

Add OpenAI to a Lovable app safely as of 2026: Lovable AI vs your own key, Secrets and edge functions, per-user limits, spend caps and prompt injection.

More on this: Production architecture & security · All glossary terms

Built something in Lovable you want people to rely on?

We are the engineers who take it the rest of the way — secured, tested, released and supported.