Skip to main content
短.be

Rate Limiting

A mechanism that caps the number of requests to an API or service within a given time window. Protects servers and ensures fair usage.

Aug 23, 2026 · About 1 min read

Security

Rate limiting caps the number of requests an API or service accepts within a defined time window. Rules like "60 requests per minute" or "1,000 requests per day" are enforced, and requests exceeding the limit receive an HTTP 429 (Too Many Requests) response. That status code is defined in RFC 6585 and tells the client it has sent too many requests in a given amount of time.

Rate limiting serves three purposes: server protection (preventing service outages from request floods), fairness (stopping individual users from monopolizing resources), and cost management (controlling pay-per-use cloud billing).

URL shortening services apply rate limiting in several areas: URL shortening API request limits (preventing spam-like mass generation), access limits on shortened URLs (mitigating DDoS attacks), and login attempt limits on dashboards (blocking brute-force attacks).

Four main rate limiting algorithms exist. Fixed window resets a counter at regular intervals. Sliding window continuously calculates requests within the most recent time frame. Token bucket replenishes tokens at a steady rate, consuming one per request. Leaky bucket processes requests at a constant rate, queuing any excess.

Developers working with rate-limited APIs should check the response headers and adjust request frequency based on the remaining quota. Header names differ from service to service: forms such as X-RateLimit-Limit and X-RateLimit-Remaining became a de facto convention, while a standard set of RateLimit headers is still being drafted at the IETF (an Internet-Draft as of August 2026). When a 429 response arrives, follow the Retry-After header if one is present and wait as instructed. If the header is missing, or if retrying after the wait still returns 429, add exponential backoff and lengthen the wait step by step. The two are separate measures: following Retry-After is not by itself exponential backoff.

Share on XHatena

Was this article helpful?

Related Terms

Related Articles

FAQ

What should I do when I hit a rate limit?
Check the Retry-After header in the HTTP 429 response and wait as long as it instructs before retrying. Retry-After can carry either a number of seconds or a date and time from which the request may be repeated, so handle both formats. The header is not always present; when it is missing, retry with a wait that grows step by step. If you hit the limit even though you send little traffic, check what the limit counts: services that count per IP address may lump together everyone leaving through the same shared connection or office network. If you frequently hit limits, space out your requests or consider upgrading to a higher-tier plan.
What are typical rate limit values?
It varies by service, but free plans commonly allow 10 to 60 requests per minute, while paid plans offer 100 to 1,000 per minute. URL shortening APIs generally cap how many links you can create per hour, sometimes alongside a per-minute cap, and the actual figures vary widely by service and plan, so check the API documentation before you build against them.
How do I implement rate limiting on my own API?
Common approaches include Nginx's limit_req module, built-in features of API gateways (like AWS API Gateway), or a custom token bucket implementation using Redis. For small-scale services, Nginx configuration alone is often sufficient.

Put the terms to work

Shorten a URL for Free