GET/api/v1/screenshot

Screenshot API

Capture pixel-perfect screenshots of any publicly accessible URL. Supports custom viewports, full page capture, element selectors, delays, and multiple output formats.

Parameters

ParameterTypeRequiredDefaultDescription
urlstringYes-The URL to screenshot. Must be publicly accessible and start with http:// or https://.
widthnumberNo1280Viewport width in pixels. Range: 320-3840.
heightnumberNo720Viewport height in pixels. Range: 240-2160.
formatstringNopngOutput format: png, jpeg, or webp. Free plan: PNG only.
fullPagebooleanNofalseCapture the full scrollable page instead of just the viewport. Pro plan and above.
delaynumberNo0Wait time in milliseconds after page load before capturing. Max: varies by plan.
selectorstringNo-CSS selector to capture a specific element instead of the full viewport.
qualitynumberNo80Image quality for JPEG/WebP format. Range: 1-100.
deviceScaleFactornumberNo1Device pixel ratio (1 for standard, 2 for retina). Range: 1-3.
jsonbooleanNofalseReturn JSON response with a temporary CDN URL instead of binary image data.

Response

By default, the API returns the screenshot as binary image data with the appropriate Content-Type header. Use ?json=true to receive a JSON response instead.

Binary Response Headers

Response Headers
Content-Type: image/png
Content-Length: 245678
X-Request-Id: req_abc123
X-RateLimit-Remaining: 49
X-Capture-Duration: 1250ms

Code Examples

cURL

cURL Examples
# Basic screenshot
curl "https://captureapi.dev/api/v1/screenshot?url=https://github.com" \
  -H "X-API-Key: cap_your_key" \
  -o github.png

# Full page, high resolution
curl "https://captureapi.dev/api/v1/screenshot?url=https://github.com&fullPage=true&width=1920&height=1080&format=webp&deviceScaleFactor=2" \
  -H "X-API-Key: cap_your_key" \
  -o github-full.webp

# Capture specific element
curl "https://captureapi.dev/api/v1/screenshot?url=https://github.com&selector=.application-main" \
  -H "X-API-Key: cap_your_key" \
  -o github-main.png

JavaScript / Node.js

JavaScript
async function captureScreenshot(url, options = {}) {
  const params = new URLSearchParams({
    url,
    width: options.width?.toString() || "1280",
    height: options.height?.toString() || "720",
    format: options.format || "png",
    ...(options.fullPage && { fullPage: "true" }),
    ...(options.delay && { delay: options.delay.toString() }),
    ...(options.selector && { selector: options.selector }),
  });

  const response = await fetch(
    `https://captureapi.dev/api/v1/screenshot?${params}`,
    {
      headers: { "X-API-Key": process.env.CAPTURE_API_KEY }
    }
  );

  if (!response.ok) {
    const error = await response.json();
    throw new Error(error.error.message);
  }

  return response.arrayBuffer();
}

// Usage
const screenshot = await captureScreenshot("https://example.com", {
  width: 1920,
  height: 1080,
  format: "webp",
  fullPage: true
});

Python

Python
import requests
import os

def capture_screenshot(url, **kwargs):
    params = {
        "url": url,
        "width": kwargs.get("width", 1280),
        "height": kwargs.get("height", 720),
        "format": kwargs.get("format", "png"),
    }
    if kwargs.get("full_page"):
        params["fullPage"] = "true"
    if kwargs.get("delay"):
        params["delay"] = kwargs["delay"]
    if kwargs.get("selector"):
        params["selector"] = kwargs["selector"]

    response = requests.get(
        "https://captureapi.dev/api/v1/screenshot",
        params=params,
        headers={"X-API-Key": os.environ["CAPTURE_API_KEY"]}
    )
    response.raise_for_status()
    return response.content

# Usage
screenshot = capture_screenshot(
    "https://example.com",
    width=1920,
    height=1080,
    format="webp",
    full_page=True
)
with open("screenshot.webp", "wb") as f:
    f.write(screenshot)

Rate Limits by Plan

PlanMonthly LimitMax ResolutionTimeoutFormats
Free50720p5sPNG
Pro2,0001080p30sPNG, JPEG, WebP
Business10,0004K60sAll
EnterpriseUnlimited4K+120sAll