Skip to main content

Decide what to do

retryAfterSeconds in the body and the Retry-After header are the same number of seconds, so read either one. When neither is there, back off: wait 0.5 s, then 1 s, then 2 s. If the wait is longer than a minute, stop retrying. A freeLimit wait can be hours, so get a key instead. After the last try, stop and log the X-Request-ID header. A failed call costs nothing, so a retry costs nothing extra. Errors lists every code.

A retry loop

Timeouts

Most calls answer within 15 seconds. A slow page, a long PDF or a transcript can take up to a minute. Set your client timeout to at least 65 seconds. Crawl, batch scrape, extract and browser tasks answer at once with an id, and you read the result with their status calls.