
Screenshot API rate limits: how to retry without capturing twice
A capture holds a browser open for the whole request, so a screenshot API has to say no sometimes. Some of those answers clear by themselves in seconds and some never will. Code that cannot tell them apart either gives up too early or keeps failing for the rest of the billing period.
· 5 min read
Three refusals, three answers
429 rate_limited: you are going too fast. Wait and the same request succeeds. Nothing has been spent.402 quota_exhausted: your plan allowance for the period is gone. Waiting a minute changes nothing; the answer is a larger plan or the next billing period.403 feature_not_available: your plan does not include a field you sent, such asproxyorcookies. No amount of waiting turns this into a yes.
429 and 503. Show 402 and 403 to a person. A retry loop that treats every refusal alike will keep failing for the rest of the billing period.The limits
The Instant Snap API has these ceilings:
- Your plan's API rate limit: 40 requests a minute on Starter, 80 on Pro, 150 on Business, 200 on Business Plus and 10 on the free trial. It limits how fast requests are accepted, not how quickly captures finish.
- 60 requests per minute, per IP address, counted before your key is looked at. Several keys behind one address share it.
- 300 reads of a capture per minute, per IP address, a window of its own, so polling an async capture never spends what your captures need.
- 2 captures at a time per workspace. A request that arrives while two are still rendering waits briefly, then answers
503 capture_busy. - 100 async captures waiting or running per workspace. Past that, a new one answers
429 queue_full.
capture_busy is not your fault and usually succeeds on the next attempt. If you see it often, lower your own concurrency; do not raise your retry count.
Wait as long as you are told
A refusal tells you how long to wait, in both the Retry-After header and the retry_after_seconds field. For a rate limit it is the seconds until the next minute.
HTTP/1.1 429 Too Many Requests
Retry-After: 31
{
"success": false,
"error_code": "rate_limited",
"error_message": "Too many requests; please wait before retrying.",
"retry_after_seconds": 31
}- Use the value you were given before falling back to exponential backoff.
- Cap the number of attempts. An unbounded retry is how one late capture becomes an outage.
- Add a little jitter if many workers share a key, or they all wake at the same instant and are refused together.
Retry without capturing twice
The dangerous retry is the one after a timeout: your code does not know whether the capture ran. Send an Idempotency-Key header (up to 255 printable characters, a UUID is ideal) and a retry with the same key and the same body never captures or charges twice. Keys are kept for 24 hours.
async function capture(body, key = crypto.randomUUID(), attempt = 0) {
const response = await fetch("https://api.websitescreenshotworld.com/instant-snap/v1/captures", {
method: "POST",
headers: {
"X-Api-Key": process.env.WSW_API_KEY,
"Content-Type": "application/json",
"Idempotency-Key": key, // the same key on every attempt
},
body: JSON.stringify(body),
});
if (response.status === 429 || response.status === 503) {
const payload = await response.json();
if (attempt >= 4) throw new Error(payload.error_code);
const wait = (payload.retry_after_seconds ?? 2 ** attempt) * 1000;
await new Promise((resolve) => setTimeout(resolve, wait));
return capture(body, key, attempt + 1);
}
return response;
}- If the first request finished, the retry gets its answer, with the header
Idempotent-Replayed: true. - If the first request is still running, the retry gets
409 idempotency_key_in_usewithretry_after_seconds. Wait and send it again. - The same key with a different body gets
409 idempotency_key_reused. Use a new key for a new capture. - A request refused before anything ran (validation, key, quota, a busy renderer) does not use up the key: retry it as it is.
The official client libraries do all of this for you. The post on website screenshots in Python shows what that looks like.
Staying under the limits
- Queue work; do not fire it all at once. Send at most two captures at a time, and pace the queue to your plan's rate limit.
- If your schedules and your code run at the same time, reserve capacity for each on the Capacity page, so one cannot hold up the other.
- Read a capture back before making it again. It is stored for 24 hours, and reading it does not consume a capture.
- For the same pages on a timetable, an Auto Schedule does the work without spending Instant Snap API calls at all.
FAQ
Does a refused request use up a capture?
No. A 429 rate_limited has spent nothing, and a 503 capture_busy does not count against your quota. Wait and send the same request again.
Are there X-RateLimit headers to read?
No. The API does not publish X-RateLimit-Limit, X-RateLimit-Remaining or X-RateLimit-Reset. Count your own calls if you need to pace yourself, and treat a 429 as the signal.
Is the rate limit per API key?
No. The allowance belongs to the workspace, not to a key, and it is shared with your Auto Schedules unless you reserve part of it for each on the Capacity page. There is no daily ceiling either.
Do the client libraries handle this for me?
Yes. Each official library retries a busy or rate-limited request up to twice, waits as long as the API asked, and sends an idempotency key on every capture so a retry is never run twice.