Hitting a 429 "Too Many Requests" error is a rite of passage for scaling apps. But handling it poorly can crash your service.
The Exponential Backoff Algorithm
We recommend specific retry logic. If a request fails, wait 1 second. If it fails again, wait 2, then 4, then 8. This simple algorithm prevents your servers from hammering the API and getting your IP banned during traffic spikes.
async function fetchWithRetry(url, retries = 3, delay = 1000) {
try {
return await fetch(url);
} catch (err) {
if (retries === 0) throw err;
await new Promise(r => setTimeout(r, delay));
return fetchWithRetry(url, retries - 1, delay * 2);
}
}
Batching Requests
Instead of making 50 calls for 50 VINs, utilize our /batch endpoints. This reduces HTTP overhead by 90% and keeps you well within your rate limits.