More endpoints
POST /v1/screenshot

POST /v1/screenshot

Render a page with a headless Playwright browser and return a screenshot.

Output: when image storage is available, the screenshot is uploaded and the response contains imageUrl. Otherwise the image is returned as a base64 string in the response body. Handle both.

If the browser cannot start, the endpoint returns HTTP 503.

Request

POST /v1/screenshot
Content-Type: application/json
x-api-key: YOUR_KEY

Body

FieldTypeRequiredDefaultDescription
urlstringYesThe URL to screenshot. Must be a valid http:// or https:// URL.
fullPagebooleanNotrueCapture the full scrollable page height. Set to false for viewport-only.
widthnumberNo1280Viewport width in pixels, clamped to 320-3840.
mobilebooleanNofalseEmulate a mobile device (iPhone viewport, mobile UA).
waitFornumberNo1000Additional delay in milliseconds after domcontentloaded before taking the screenshot, clamped to 0-10000.
cookiesstringNoJSON array of cookie objects ([{"name":"…","value":"…","domain":"…"}]). Injected before page load.
elementstringNoCSS selector. When provided, only the first matching element is captured instead of the full page.
format"png" | "jpeg"No"png"Image format.

Example request: full page

curl -X POST https://api.superscraper.dev/v1/screenshot \
  -H "x-api-key: ss_live_xxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://www.iana.org/about",
    "fullPage": true,
    "width": 1440,
    "waitFor": 1500
  }'

Example request: mobile viewport

curl -X POST https://api.superscraper.dev/v1/screenshot \
  -H "x-api-key: ss_live_xxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "mobile": true,
    "format": "jpeg"
  }'

Example request: element capture

curl -X POST https://api.superscraper.dev/v1/screenshot \
  -H "x-api-key: ss_live_xxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://www.iana.org/about",
    "element": "article"
  }'

Response

HTTP 200 on success.

Body: stored image (URL response)

FieldTypeDescription
urlstringThe URL that was screenshotted
imageUrlstringPublic URL of the stored image
widthnumberCaptured image width in pixels
heightnumberCaptured image height in pixels
formatstringImage format: "png" or "jpeg"
latencyMsnumberTime to render and capture in milliseconds
dailyLimitnumberYour tier's daily screenshot quota

Body: inline image (base64 response)

FieldTypeDescription
urlstringThe URL that was screenshotted
base64stringRaw base64-encoded image bytes
widthnumberCaptured image width in pixels
heightnumberCaptured image height in pixels
formatstringImage format: "png" or "jpeg"
latencyMsnumberTime to render and capture in milliseconds
dailyLimitnumberYour tier's daily screenshot quota

Example response: stored image

{
  "url": "https://www.iana.org/about",
  "imageUrl": "https://screenshots.superscraper.dev/screenshots/tenant_abc/f47ac10b-58cc.png",
  "width": 1440,
  "height": 4820,
  "format": "png",
  "latencyMs": 3210,
  "dailyLimit": 1000
}

Example response: base64 fallback

{
  "url": "https://example.com",
  "base64": "iVBORw0KGgoAAAANSUhEUgAAB...",
  "width": 1280,
  "height": 3400,
  "format": "png",
  "latencyMs": 2840,
  "dailyLimit": 10
}

Daily limits by tier

PlanScreenshots / day
Free10
Hobby100
Pro1 000
Scale5 000
Custom50 000

The response includes your plan's dailyLimit for screenshots so clients can track usage.

Errors

StatusErrorCause
400`url` is requiredurl field missing
400Invalid URLURL is not a valid http(s):// URL
400Invalid JSON bodyMalformed request body
401API key requiredMissing x-api-key header
429Rate limit exceededToo many requests in the sliding window
402daily_limit_reachedThe plan's daily screenshot limit is used up. Retry after 00:00 UTC or upgrade.
422not_found, element_not_foundThe page answered 404/410, or the element selector matched nothing
429screenshot_busyThe renderer is at capacity. Retry after the Retry-After seconds.
502target_unreachable, target_http_errorThe page could not be loaded, or answered an error status
502screenshot_failedThe capture failed. Retry, or try fullPage: false.
500screenshot_internal_errorAn internal error. Retry; contact support if it persists.
503Screenshot engine unavailableThe browser could not be started. Retry later.

Notes

  • If storing the image fails, the response falls back to base64. A failed upload never causes a 500.
  • When element is specified, the height field reflects the element's bounding box height.
  • Mobile emulation uses an iPhone UA and isMobile: true in Playwright context.
  • Cookies must be valid JSON ([{"name":"sid","value":"abc","domain":"example.com"}]), not Netscape cookie-jar format.