Skip to main content

Taking Screenshots

info

Currently, Browserless V2 is available in production via two domains: production-sfo.browserless.io and production-lon.browserless.io

The screenshot API allows for simple navigation to a site and capturing a screenshot. browserless will respond with either a binary or base64 encode of a png or jpg (depending on parameters). This API exposes most of puppeteer's screenshot API through the posted JSON payload.

You can check the full Open API schema here.

Bot detection

If the /screenshot API is getting blocked by bot detectors, then we would recommend trying BrowserQL.

On this collection we'll look at:

Basic Usage

BQL (Stealth)

If the /screenshot API is getting blocked by bot detectors, then we would recommend trying BrowserQL.

mutation Screenshot {
goto(url: "https://example.com") {
status
}

screenshot(omitBackground:true) {
base64
}
}
BQL Schemas

For more details on BQL mutations, refer to the BrowserQL Schema reference pages.

Rest API (Without Stealth)

Bot detection

Browserless recommends using our REST API to take screenshots, unless you need to get past bot detectors.

curl -X POST \
https://production-sfo.browserless.io/screenshot?token=YOUR_API_TOKEN_HERE \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-d '{
"url": "https://example.com/",
"options": {
"fullPage": true,
"type": "png"
}
}' \
--output "screenshot.png"