Screenshot API error ยท HTTP 422
Invalid parameters
invalid_parameters
errors object names each parameter and what is wrong, for example The delay field must not be greater than 30.How to recognize it
The API answers with status 422 and a JSON body with the message and the error.code invalid_parameters, for example:
HTTP/1.1 422
Content-Type: application/json
{
"error": {
"code": "invalid_parameters",
"message": "Validation error"
},
"message": "Validation error"
}Common causes
- A value outside its bounds:
qualityoutside 0 to 100, a viewport outside its size limits, more than 50hide_selectors. - A URL that is not a valid
httporhttpsURL:The url field must be a valid URL., orOnly http and https URLs are allowed.for a well-formed URL with another scheme, such asftp://. - HTML input with problems: more than one of
url,htmlandmarkdown, or none of them,htmlover 10 MB (50 MB withasync=true),markdownover 1 MB, orhtmlin the query string instead of a JSON body. - A PDF whose
pdf_page_rangesselect no page of the document:The pdf_page_ranges select no page of the rendered document.
How to fix it
- Read the
errorsobject and fix the named parameters. - Check the limits in the take reference.
Billing
Not billed: a request answered with this error does not count against your quota. Most of these are found before the render starts; a pdf_page_ranges that selects no page, a PDF header or footer template Chrome cannot print and a selector the browser refuses are found while it renders. 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.
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