Screenshot API error ยท HTTP 422

Target is a file, not a page

target_not_renderable

The URL answered with a file instead of a web page: a PDF, or something the browser downloads instead of showing it. There is nothing to render, so the API answers as soon as the website’s answer arrives. The message names the file’s type.

How to recognize it

The API answers with status 422 and a JSON body with the message and the error.code target_not_renderable, for example:

HTTP/1.1 422
Content-Type: application/json

{
  "error": {
    "code": "target_not_renderable",
    "message": "The target URL answered with a file (application/pdf), not a web page, so it cannot be rendered."
  },
  "message": "The target URL answered with a file (application/pdf), not a web page, so it cannot be rendered."
}

Common causes

  • A link straight to a PDF document (Content-Type: application/pdf), such as https://example.com/report.pdf.
  • A download: a file sent with Content-Disposition: attachment, or a type the browser does not display, such as application/zip or text/csv.
  • A page that redirects to such a file.

How to fix it

  1. Render the web page that links the file, not the file itself.
  2. Download a PDF or other file directly: the API renders web pages, not files.
  3. Only the answer to the URL itself counts: a page that starts a download while it loads (“Your download will start …”) is captured as usual.

Billing

Not billed: a request answered with this error does not count against your quota.

Related parameters

url. 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

More free tools

Start using our Screenshot API for free today!

Get 300 requests / month for free