Screenshot API error ยท HTTP 422
Target on a private network
target_blocked_private_range
How to recognize it
The API answers with status 422 and a JSON body with the message and the error.code target_blocked_private_range, for example:
HTTP/1.1 422
Content-Type: application/json
{
"error": {
"code": "target_blocked_private_range",
"message": "URLs targeting private or reserved IP ranges are not allowed."
},
"message": "URLs targeting private or reserved IP ranges are not allowed."
}Common causes
localhost,127.0.0.1,10.x,192.168.x, link-local or cloud metadata addresses:URLs targeting localhost are not allowed.orURLs targeting private or reserved IP ranges are not allowed.- Internal host names such as
*.local,*.internalor single-label names:URLs targeting internal host names are not allowed. - A public domain that resolves to a private address, or a page that redirects to one.
How to fix it
- Render a public URL. For a site on your own machine or network, send its HTML in the
htmlfield of a POST request, or expose it with a tunnel.
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.
The same error in a browser
Chrome shows this failure as ERR_ACCESS_DENIED.
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