Screenshot API error ยท HTTP 502
Your proxy failed
proxy_error
proxy), and the proxy failed: it could not be reached, refused the credentials or did not answer as a proxy, or it could not connect to the website (Your proxy could not connect to the target website.).How to recognize it
The API answers with status 502 and a JSON body with the message and the error.code proxy_error, for example:
HTTP/1.1 502
Content-Type: application/json
{
"error": {
"code": "proxy_error",
"message": "Your proxy could not be used: it could not be reached, refused the credentials or did not answer as a proxy."
},
"message": "Your proxy could not be used: it could not be reached, refused the credentials or did not answer as a proxy."
}Common causes
- A wrong host, port or scheme in
proxy(an HTTP proxy given assocks5, say), or a proxy that is down. - A wrong user name or password, or
@,:or/in them that are not percent-encoded. - A proxy that accepts connections only from some IP addresses.
- The proxy could not reach the website, or refused it by its own rules.
How to fix it
- Test the proxy from another machine, for example
curl -x socks5h://user:password@proxy.example.com:1080 https://example.com. - Percent-encode
@,:and/in the user name and password. - Put hosts that should not go through the proxy into
proxy_bypass_hosts: they are loaded directly.
Retry
When the proxy works again. A retry right away usually fails the same way.
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
proxy, proxy_bypass_hosts. 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 100+ countries, 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 format=png \
-H "apikey: YOUR-API-KEY" \
-o screenshot.png