SearchAPI does not impose its own rate limits, but the upstream search engines it queries — primarily DuckDuckGo’s DDGS library — do. When a search engine returns an error or blocks a request, SearchAPI retries automatically. Understanding how that retry mechanism works, and how to configure your client to stay within engine limits, will help you run high-volume collection without interruption.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/pratyay360/searchapi/llms.txt
Use this file to discover all available pages before exploring further.
How SearchAPI handles retries
Every search function retries the upstream request up to 7 times before raising an error. Each failed attempt is logged, and the next attempt begins immediately. If all 7 attempts fail, SearchAPI raises aRuntimeError and returns a 500 Internal Server Error to your client.
The 7-retry limit applies to all search endpoints — web, papers, PDFs, books, news, filetypes, repositories, and wiki. Each individual attempt uses a 100-second timeout before it is counted as a failure.
Why upstream rate limiting happens
SearchAPI uses DuckDuckGo’s DDGS library as its primary meta-search engine. When you send many requests in quick succession, DuckDuckGo may throttle or temporarily block the search session. This shows up as aRuntimeError from the DDGS library, which SearchAPI catches and retries.
The /search/engine endpoint (which targets a specific engine by name) carries additional risk: engines like Google monitor for automated traffic and are more likely to return blocks or CAPTCHAs when queried directly.
Engine rotation on the general endpoint
TheGET /search/ endpoint does not target a single engine. It randomly selects from the available engines on each request, distributing load across multiple providers. This makes it less likely that any single engine will flag your traffic.
Mitigation strategies
Add a politeness delay between requests
The most effective way to avoid upstream rate limits is to pause between successive API calls. A delay of 1–3 seconds is sufficient for most use cases; increase it if you are collecting thousands of results.politeness_delay.py
Route through a proxy, VPN, or Tor
If you are hitting rate limits despite politeness delays, routing your SearchAPI instance through a proxy, VPN, or Tor distributes your requests across different IP addresses. Configure this at the network or container level, not in the API client.Using Tor will significantly increase response latency. Use it only when other mitigation strategies are insufficient.
What errors look like
SearchAPI returns two error shapes depending on where the failure occurs. Client error (400 Bad Request) — returned when a required parameter is missing or invalid:error_handling.py
Best practices for high-volume collection
- Use
GET /search/instead ofGET /search/enginefor bulk queries. - Add a delay of at least 1–2 seconds between successive requests.
- Spread queries across time — batching hundreds of requests in minutes is more likely to trigger blocks than spreading them over hours.
- Monitor for 500 errors — a pattern of 500 responses indicates persistent upstream blocking. Add exponential backoff or switch to a proxy.
- Rotate query phrasing — subtle variation in query wording reduces the chance that a session is flagged as a scraper.
- Use multiple SearchAPI instances behind different IPs for very high-volume workloads.