Screenshot API error ยท HTTP 408
Target took too long
target_timeout
timeout, or the render did not finish within its time limit, counted from the start of the request (see status codes).How to recognize it
The API answers with status 408 and a JSON body with the message and the error.code target_timeout, for example:
HTTP/1.1 408
Content-Type: application/json
{
"error": {
"code": "target_timeout",
"message": "The target website took too long to load."
},
"message": "The target website took too long to load."
}Common causes
- A slow page, or
wait_until=networkidle0on a page that never stops loading (chat widgets, analytics, long polling). - A long
delayon top of a slow page. - A server that accepts the connection and answers very slowly.
- A
wait_for_selectorthat did not match withintimeout, oractionsthat used up the render’s time: themessagethen names the step (The render ran out of time during actions.3 (wait_for_navigation).).
How to fix it
- Use a less strict
wait_until, such asloadordomcontentloaded. - Shorten
delay, or capture the viewport instead of the full page. - Check that the page loads in a normal browser in a few seconds.
- With
best_attempt=true, a page that is not ready in time is captured as it is (X-Render-Status: partial), and billed like any render.
Billing
Not billed: a request answered with this error does not count against your quota. One exception: when an evaluate step of actions or the scripts ran in the page before the render failed, it is billed as one request, because that code could read the page, unless the failure is ours.
Related parameters
timeout, navigation_timeout, wait_until, wait_for_selector, delay, best_attempt. Each is described in the take endpoint reference.
Every response carries an X-Request-Id header. If this page does not explain the error, write to support@screenshotbase.com with that id. All statuses: status codes.
Other API errors
Screenshot API
Take screenshots from your code
screenshotbase renders any website in a real browser and returns the image: full page or viewport, any device size, retina, from 117 countries (paid plans), with cookie banners and ads hidden.
/v1/take documentation Screenshot API All documentation
300 free screenshots every month. No credit card required.
GET https://api.screenshotbase.com/v1/take?url=https://example.com&full_page=true
# Response: the image (PNG, JPG, WebP, AVIF or GIF)
curl -G "https://api.screenshotbase.com/v1/take" \
--data-urlencode "url=https://example.com" \
-d viewport_width=1280 -d viewport_height=800 \
-d full_page=true -d format=png \
-H "apikey: YOUR-API-KEY" \
-o screenshot.png