Menu
Docs/Sync Batch Screenshots

Sync Batch Screenshots

Capture screenshots of multiple URLs in one request. Returns base64-encoded images with per-URL success/error status.

POST/v1/batch

Batch screenshots require a Growth+ plan. Max URLs per request depends on your plan.

Parameters

ParameterTypeDefaultDescription

Plan limits

PlanMax URLs per request
Free❌ Not available
Starter❌ Not available
Growth10
Business25
Enterprise50

Response

{
  "request_id": "550e8400-e29b-41d4-a716-446655440000",
  "total": 3,
  "succeeded": 2,
  "failed": 1,
  "results": [
    {
      "url": "https://example.com",
      "success": true,
      "image_base64": "iVBORw0KGgo...",
      "content_type": "image/png",
      "size_bytes": 145230
    },
    {
      "url": "https://another.com",
      "success": true,
      "image_base64": "iVBORw0KGgo...",
      "content_type": "image/png",
      "size_bytes": 89400
    },
    {
      "url": "https://blocked-site.com",
      "success": false,
      "error": "Navigation timeout after 30000ms"
    }
  ]
}

Example

curl -X POST https://api.snapsharp.dev/v1/batch \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "urls": [
      "https://github.com",
      "https://linear.app",
      "https://vercel.com"
    ],
    "width": 1280,
    "format": "png",
    "dark_mode": true
  }'
// Each result is independent — one failing URL won't stop the others
const res = await fetch('https://api.snapsharp.dev/v1/batch', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer sk_live_...',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    urls: ['https://github.com', 'https://linear.app'],
    width: 1280,
    dark_mode: true,
  }),
});

const data = await res.json();
for (const result of data.results) {
  if (result.success) {
    const buffer = Buffer.from(result.image_base64, 'base64');
    // save or process the image
  }
}
import httpx, base64, os

api_key = os.environ["SNAPSHARP_API_KEY"]

response = httpx.post(
    "https://api.snapsharp.dev/v1/batch",
    headers={"Authorization": f"Bearer {api_key}"},
    json={
        "urls": ["https://github.com", "https://linear.app", "https://vercel.com"],
        "width": 1280,
        "format": "png",
        "dark_mode": True,
    },
    timeout=60.0,
)
response.raise_for_status()
data = response.json()

for result in data["results"]:
    if result["success"]:
        img = base64.b64decode(result["image_base64"])
        with open(f"screenshot_{data['results'].index(result)}.png", "wb") as f:
            f.write(img)
    else:
        print(f"Failed: {result['url']}{result.get('error')}")
<?php
$apiKey = getenv('SNAPSHARP_API_KEY');
$payload = json_encode([
    'urls' => ['https://github.com', 'https://linear.app', 'https://vercel.com'],
    'width' => 1280,
    'format' => 'png',
    'dark_mode' => true,
]);

$ch = curl_init('https://api.snapsharp.dev/v1/batch');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => $payload,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 60,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer $apiKey",
        'Content-Type: application/json',
    ],
]);

$body = curl_exec($ch);
curl_close($ch);

$data = json_decode($body, true);
foreach ($data['results'] as $i => $result) {
    if ($result['success']) {
        file_put_contents("screenshot_$i.png", base64_decode($result['image_base64']));
    }
}

Errors

CodeErrorDescription
400validation_errorInvalid parameters or empty urls array
401unauthorizedMissing or invalid API key
403plan_requiredGrowth+ plan required
429rate_limitedRate limit exceeded
500Internal server error
Sync Batch Screenshots