API reference
Capture (Screenshot)
Capture any webpage as PNG, JPEG, WebP or PDF — full page, element, or 18 real devices.
http://localhost:4000/v1/capture- Credit cost
- 1 per successful request
- Async
- Supported (is_async)
- 404 billed
- No
- Plans
- All plans
Authenticate with the x-api-key header. See authentication and credits & billing.
Parameters
Basics
| Parameter | Description |
|---|---|
urlstringrequired | The URL of the webpage to capture. Example: |
formatenum | Output format. Default: Values: |
image_qualitynumber | Quality 1-100 for jpeg/webp. |
selectorstring | Capture a specific element instead of the viewport. |
Viewport
| Parameter | Description |
|---|---|
deviceenum | Device to emulate (viewport, DPR, user agent, touch). Values: |
full_pageboolean | Capture the entire page instead of just the viewport. |
full_page_scrollboolean | Scroll the page to trigger lazy-loaded content before a full-page capture. |
full_page_scroll_durationnumber | Time in milliseconds spent scrolling before the full-page capture. |
viewport_widthnumber | Viewport width in pixels. Default: |
viewport_heightnumber | Viewport height in pixels. Default: |
scale_factornumber | Device scale factor (1-3) for high-resolution screenshots. Default: |
dark_modeboolean | Emulate prefers-color-scheme: dark. |
Cache
| Parameter | Description |
|---|---|
cacheboolean | Cache the response at the edge. |
cache_ttlnumber | Custom cache TTL in seconds (max 2,592,000 = 30 days, default 86,400). |
Page
| Parameter | Description |
|---|---|
remove_selectorsstring | Comma-separated CSS selectors to hide before capturing (e.g. ads, popups). |
remove_cookie_bannersboolean | Automatically remove cookie banners before capturing. |
remove_adsboolean | Automatically remove ads before capturing. |
block_resourcesenum[] | Comma-separated list of resource types to block (e.g. image,stylesheet,font). Values (comma-separated): |
block_urlsstring | Comma-separated URL patterns to block (e.g. analytics,tracking,.example.com/). |
Timing
| Parameter | Description |
|---|---|
delaynumber | Delay in seconds before capturing (max 30). |
wait_untilenum[] | When to consider navigation finished. Default: Values (comma-separated): |
wait_for_selectorstring | Wait for a specific element to appear before capturing. |
Network
| Parameter | Description |
|---|---|
proxystring | Proxy to route the request through (http://user:pass@host:port, https:// or socks5://). |
stealthboolean | Stealth mode: fingerprint hardening and user-agent rotation to reduce bot detection (paid plans). |
user_agentstring | Override the browser user agent. |
headersjson | Extra HTTP headers as a JSON object. |
cookiesjson | Cookies to set, as a JSON array of {name,value,domain?,path?}. |
Storage
| Parameter | Description |
|---|---|
s3_access_key_idstring | S3 access key ID. |
s3_secret_keystring | S3 secret access key. |
s3_bucketstring | Bucket to upload the screenshot to. |
s3_object_keystring | Object key (auto-generated if empty). |
s3_regionstring | S3 region. |
storage_endpointstring | S3-compatible endpoint (e.g. https://<account>.r2.cloudflarestorage.com). Empty = AWS. |
s3_urlboolean | Upload and return JSON with the file URL instead of the binary image. |
Global parameters
Accepted by every billable endpoint. Details in Global parameters.
| Parameter | Description |
|---|---|
soft_failboolean | Return HTTP 200 even when an error occurs, with the message in Default: |
is_asyncboolean | Process asynchronously; returns a Default: |
fieldsstring | Comma-separated list of response fields to keep (dot notation for nested). |
webhook_urlstring | With is_async=true, POST the finished job to this URL (signed, paid plans). |
Code examples
curl -G "http://localhost:4000/v1/capture" \
--data-urlencode "url=https://example.com" \
--data-urlencode "format=png" \
--data-urlencode "full_page=true" \
-H "x-api-key: $SCREENSHOTDUDE_API_KEY" \
-o screenshot.pngResponses
200 — binary file (default)
HTTP/1.1 200 OK
content-type: image/png # image/jpeg, image/webp or application/pdf
x-cache: MISS
x-credits-charged: 1
<binary data>200 — with s3_url=true
{
"success": true,
"data": {
"url": "https://my-bucket.s3.eu-west-1.amazonaws.com/screens/acme-home.png",
"key": "screens/acme-home.png",
"bucket": "my-bucket"
}
}202 — with is_async=true
{
"success": true,
"job_id": "job_4f8k2m9q1x7c3v5b6n0z8l2p",
"status": "Queued"
}Response format
By default the response body is the file:
format |
Content-Type |
|---|---|
png (default) |
image/png |
jpeg, jpg |
image/jpeg |
webp |
image/webp |
pdf |
application/pdf |
Useful response headers: x-cache (HIT or MISS) and x-credits-charged.
With s3_url=true the file is uploaded to your bucket and the response is JSON { success, data: { url, key, bucket } } — see S3 / R2 upload. With is_async=true you get 202 and a job_id — see Async jobs.
Devices
device accepts one of 18 profiles: iphone_14_pro_max, iphone_14_pro, iphone_13_pro_max, iphone_13_mini, iphone_12, iphone_x, ipad, galaxy_s23_ultra, galaxy_s23, galaxy_s8, galaxy_fold4, pixel_7_pro, pixel_6a, pixel_5, redmi_note_12_pro, redmi_note_11, huawei_p60_pro, huawei_mate_50_pro. A device sets the viewport, device scale factor, user agent and touch support; it overrides viewport_width, viewport_height and scale_factor.
Waiting strategies
wait_until |
Navigation is considered finished when… |
|---|---|
load (default) |
the load event fires |
domcontentloaded |
the HTML is parsed (fastest, images may be missing) |
networkidle0 |
there are no network connections for 500 ms |
networkidle2 |
there are at most 2 network connections for 500 ms |
Combine with wait_for_selector (wait for an element) and delay (extra seconds, max 30).
Blocking
block_resources— comma-separated resource types:document,stylesheet,image,media,font,script,texttrack,xhr,fetch,eventsource,websocket,manifest,other.block_urls— comma-separated substrings; any request URL containing one is aborted (for exampleanalytics,tracking,doubleclick).remove_selectors— elements hidden before capture.remove_cookie_banners,remove_ads— automatic cleanup.
Headers and cookies
headers takes a JSON object and cookies a JSON array. URL-encode them:
curl -G "http://localhost:4000/v1/capture" \
--data-urlencode "url=https://app.example/dashboard" \
--data-urlencode 'headers={"Authorization":"Bearer abc123"}' \
--data-urlencode 'cookies=[{"name":"session","value":"xyz","domain":"app.example"}]' \
-H "x-api-key: $SNAPLENS_API_KEY" -o dashboard.pngErrors
Errors return JSON { "error": "…" }. Failed requests are never billed. Full list in Status codes.
| Status | Meaning |
|---|---|
| 400 | Missing or invalid parameter (e.g. invalid URL, unsupported format, private network target) |
| 401 | Invalid, inactive or expired API key; plan rate limit (Rate limit exceeded: …) or key quota (…: quota daily) |
| 403 | IP temporarily blocked after repeated authentication failures; endpoint not included in your plan |
| 402 | Payment required, You have open invoices: … or Insufficient credits: X required, Y available |
| 404 | Target page not found — not billed |
| 413 | Result too large (e.g. extremely tall full-page capture) |
| 500 | Rendering failed or timed out (60 s) — not billed; retry or use is_async=true |