You can use a bulk screenshot-taking feature to take many screenshots in one request.
Send a simple POST HTTP request to /bulk path with the list of URLs (HTML or Markdown):
The options property contains default options that will be applied to every request. And for every request, you can specify options to override the default values. You can specify all the regular options you use to take a single screenshot.
You can specify the access key as a query parameter access_key=<your access key>, an HTTP header X-Access-Key: <your access key>, or in the request’s body.
Response
The response contains an array of screenshot URLs you can use to download the screenshots:
But if you requested to execute requests, the result will also contain a summary execution response for each request:
As you noticed, images are not returned, but in case of an error, the is_successful property will be false, and you can expect the body property to explore the error:
Execute requests
Bulk screenshots are implemented in a lazy loading way. It means that the screenshot is literally taken when you tried to download it, not when you sent a bulk request. If you want to execute each request before you get a response, set the parameter execute to true:
But make sure to wait enough time until all the screenshots are done.
Optimizations
To take bulk screenshots faster, you can use the optimization feature if you want to take bulk screenshots for the same URLs (HTML or Markdown) but with a different set of parameters:
The feature only works when execute is set to true.
The optimization is not guaranteed since many sites can reload and take the same time to render in case the viewport is changed. And some options, like blocking and not blocking ads, do require a page reload, which takes the same time as not using optimization at all.
The best approach is to test if it works for your use case.
Use cases
Upload bulk screenshots to S3-compatible storage
In the example, I want to take screenshots for one site but for different devices and upload them to S3-compatible storage:
In this example, I upload screenshots taken from different devices and save the files with the names of the devices.
Limitations
Currently, only up to 20 requests are supported in the one bulk request.