Skip to main content
Screenshotly’s batch capture feature lets you capture screenshots of multiple URLs in a single request, with shared settings applied to all URLs.

Basic batch request

const result = await client.captureBatch({
  urls: [
    'https://example.com',
    'https://google.com',
    'https://github.com'
  ],
  options: {
    format: 'png',
    width: 1280,
    height: 800,
    fullPage: true
  }
});

if (result.success) {
  result.data.forEach((item) => {
    console.log(`${item.url}: ${item.imageUrl}`);
  });
  console.log('Remaining credits:', result.remainingCredits);
}

Response format

The batch response includes individual results for each URL:
{
  "success": true,
  "data": [
    {
      "url": "https://example.com",
      "status": "completed",
      "imageUrl": "https://api.screenshotly.dev/api/v1/screenshots/scr_001.png"
    },
    {
      "url": "https://google.com",
      "status": "completed",
      "imageUrl": "https://api.screenshotly.dev/api/v1/screenshots/scr_002.png"
    },
    {
      "url": "https://github.com",
      "status": "failed",
      "error": "Page load timeout"
    }
  ],
  "remainingCredits": 4997
}
Individual URLs in a batch can fail independently. Always check the status of each result.

Shared options

All options passed in the options object apply to every URL in the batch:
OptionTypeDescription
formatstringOutput format (png, jpeg, webp)
widthintegerViewport width
heightintegerViewport height
fullPagebooleanCapture full scrollable page
delayintegerDelay in milliseconds
deviceScaleFactornumberDevice pixel ratio

Handling large batches

For large numbers of URLs, break them into smaller chunks to avoid timeouts and manage rate limits:
const allUrls = [/* hundreds of URLs */];
const chunkSize = 25;

for (let i = 0; i < allUrls.length; i += chunkSize) {
  const chunk = allUrls.slice(i, i + chunkSize);
  const result = await client.captureBatch({
    urls: chunk,
    options: { format: 'png', width: 1280, height: 800 }
  });

  console.log(`Batch ${i / chunkSize + 1}: ${result.data.length} captured`);
}
Combine batch processing with webhooks for long-running batches. Set a webhookUrl in your options to get notified when the entire batch completes.

Credits

Each URL in a batch consumes one screenshot credit. A batch of 10 URLs uses 10 credits. Failed captures within a batch do not consume credits.