How to fix API rate limit (429 Too Many Requests) errors

Why APIs return 429 errors, how to handle them gracefully with backoff and retries, and how to reduce the number of requests your application makes.

By the UK Technology Hub teamPublished 4 minute read

The short answer

A 429 Too Many Requests error means you've exceeded an API's rate limit: too many requests, tokens or concurrent calls in a time window. Handle it by respecting the Retry-After header, retrying with exponential backoff and random jitter, and limiting concurrency. Then reduce demand with caching, batching, queues and smarter request patterns, and request higher limits if your usage genuinely needs them.

APIs protect themselves and their users by limiting how many requests each client can make. When you exceed the limit, they respond with HTTP status 429, "Too Many Requests." It's common with AI APIs, payment providers, social platforms and any busy service.

Understand the limits

Rate limits can apply to:

  • Requests per second, minute or day.
  • Tokens processed per minute, common for AI APIs.
  • Concurrent requests.
  • Specific endpoints or actions.
  • Per API key, user, account or IP address.

Read the provider's documentation for your plan's limits.

Read the response headers

Many APIs include headers such as:

  • Retry-After: how long to wait before retrying.
  • Rate limit headers: your limit, remaining requests and reset time, under various names.

Log these headers; they tell you how close you are to limits.

Handle 429 errors gracefully

Respect Retry-After

If the API tells you when to retry, wait at least that long.

Exponential backoff with jitter

When retrying without explicit guidance, wait progressively longer between attempts: for example 1, 2, 4 and 8 seconds, adding a random amount (jitter) so many clients don't retry at the same moment. Cap the number of retries and the maximum wait.

Limit concurrency

Use a queue or concurrency limiter so your application never sends more simultaneous requests than allowed.

Fail gracefully

If retries run out, show users a helpful message, save the work for later or fall back to cached data. Don't hammer the API.

Reduce how many requests you make

  • Cache responses that don't change often.
  • Batch requests where the API supports it.
  • Use webhooks instead of polling for updates.
  • Debounce user actions, such as search-as-you-type, so you don't send a request on every keystroke.
  • Deduplicate requests for the same data.
  • Paginate efficiently and request only needed fields.

AI APIs specifically

AI providers often limit both requests and tokens. Shorter prompts, smaller models for simple tasks, caching and batch processing reduce load and cost. Our guide to AI cost optimisation covers these techniques in depth.

Background jobs and queues

Move non-urgent work, such as bulk imports, report generation and notifications, to background queues that process items at a controlled rate within limits.

Monitor and alert

Track 429 rates, retries and remaining quota. Alert before you hit limits during busy periods, and review usage patterns to spot runaway loops or bugs.

Request higher limits

If your legitimate usage exceeds your plan, ask the provider about higher tiers or limit increases. Many providers raise limits as accounts build history.

Rate limiting your own API

If you run an API, implement rate limits to protect it, return 429 with clear Retry-After headers and document your limits for clients.

Browser-specific API errors

If calls fail in the browser before reaching rate limits, check CORS configuration; see our guide to fixing CORS errors.

Designing for limits from the start

When building an integration, estimate peak request volumes before launch, especially for imports, sync jobs and busy periods. Design with queues, caching and batching from day one, rather than adding them after users start seeing errors.

A worked example

A shop syncs inventory with a marketplace every few minutes, sending one request per product. As the catalogue grows, requests exceed the marketplace's limits and updates fail. The fix: switch to the marketplace's bulk update endpoint, send only products whose stock changed and process updates through a queue that respects rate limit headers. Requests drop sharply and errors disappear.

Communicating with users

If rate limits delay a user-facing action, tell users what's happening and when it will complete, rather than showing a generic error. Background processing with notifications on completion often works better than making users wait.

Testing rate limit handling

Simulate 429 responses in tests to make sure retries, backoff and user messages work correctly. It's much better to discover problems in testing than during a busy sales day.

How we help

Our web app development team builds resilient API integrations with queues, caching and backoff. Our AI solutions team manages AI API limits and costs, and our app development service designs apps that handle limits gracefully.

Frequently asked questions

What does HTTP 429 mean?

Too Many Requests: you've exceeded the API's rate limit for a time window.

How long should I wait after a 429 error?

Follow the Retry-After header if provided. Otherwise use exponential backoff with jitter.

Can I avoid rate limits completely?

Not entirely, but caching, batching, queues and efficient request patterns keep you well within limits.

This guide is general information, not legal, tax or financial advice, and details such as prices, features and rules can change. Product and company names mentioned are trademarks of their respective owners and are used only to identify those products; UK Technology Hub is not affiliated with or endorsed by them.

Related guides

How to fix CORS errors: a practical guide

What CORS errors actually mean, why they happen, and how to fix them correctly on the server, including preflight requests, credentials and common mistakes.

How to fix the WordPress white screen of death

A calm, step-by-step guide to diagnosing and fixing a blank white WordPress page, from recovery mode and debug logs to plugins, themes and memory limits.

All bug fixes & troubleshooting guides