Skip to content
Docs menu

Browser API

Screenshot

Capture a page in a real browser as PNG, JPEG or WebP: the viewport, the whole page or one element, on a desktop or a phone, with cookie banners hidden. One capture per request, one price.

POST https://api.104-236-84-15.sslip.io/v1/screenshot

Body parameters

Screenshot parameters
NameTypeDescription
urlrequiredstring (≤ 2048 chars)Absolute http:// or https:// URL. No embedded credentials, no private or internal hosts.
full_pagebooleanCapture the whole scrollable page instead of the viewport, cut at max_height. Default: false.
max_heightinteger (100–16384)Height cap in CSS pixels for full_page and selector captures. Never more than 16,384 device pixels: 16,384 CSS px at 1x, a third of that on a 3x phone. A taller page is cut and the response says clipped. The price is the same either way.
selectorstringCSS selector of one element to capture (the first visible match), e.g. "#pricing". 422 selector_not_found, not charged, when nothing visible matches within 5 s of the page loading. Not with full_page.
devicestringDevice preset (below): viewport, pixel ratio, touch, mobile layout and user agent together. Not with viewport.
viewport{ width, height }Viewport in CSS pixels: width 320–3840, height 240–4320. Both are required when you send it.
format"png" | "jpeg" | "webp"Image format. WebP is the smallest. type is accepted as an older name. Default: "png".
qualityinteger (1–100)JPEG and WebP quality. Default: 80.
omit_backgroundbooleanTransparent background where the page paints none (png and webp). Default: false.
hide_selectorsstring[] (up to 20)CSS selectors hidden (display: none) right before the capture: cookie banners, chat widgets, promo bars. Selectors that match nothing are ignored; an invalid one is a 400.
dark_modebooleanEmulate prefers-color-scheme: dark, for sites that follow the system theme. Default: false.
unblock"none" | "stealth" | "residential" | "auto"Unblocking tier. residential goes through your team's own proxy. auto escalates none → stealth → residential (when your team has a proxy) and charges only for the tier that succeeded. See Unblocking tiers. Default: "none".
timeout_msinteger (1000–120000)Time budget for the whole request, shared by every unblock tier tried. Running out returns 504 timeout (not charged). Default: 30000.
max_ageinteger (seconds, 0–86400)Opt-in cache. If your account made the same request (same URL and options) within max_age seconds, you get that response back without us contacting the site, for 0 credits. An older copy is revalidated with a conditional request when the site supports it. 0 always fetches but stores the result. Omit it and the cache is not used. See Render → Caching.
respect_robotsbooleanCheck the site’s robots.txt (user agent PageteerBot) first. A disallowed URL fails with 403 robots_disallowed and is not charged; a Crawl-delay spaces our requests to that site. Default: false.
actionsobject[] (≤ 20)Read-only page actions run in the browser after the page loads: wait, wait_for, scroll, click ("Load more", tabs, accordions), press and screenshot. Forces a browser render. No typing, form submission or logins. See Page actions.

Examples

curl
curl -X POST https://api.104-236-84-15.sslip.io/v1/screenshot \
  -H "Authorization: Bearer $PAGETEER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com","full_page":true,"format":"png"}' \
  -o example.png
JavaScript (fetch)
const res = await fetch('https://api.104-236-84-15.sslip.io/v1/screenshot', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.PAGETEER_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "url": "https://example.com",
    "full_page": true,
    "format": "png"
  }),
});
if (!res.ok) throw new Error((await res.json()).error.message);
const bytes = Buffer.from(await res.arrayBuffer());
await import('node:fs/promises').then(fs => fs.writeFile('example.png', bytes));
Python (requests)
import os
import requests

headers = {"Authorization": f"Bearer {os.environ['PAGETEER_API_KEY']}"}
res = requests.post(
    "https://api.104-236-84-15.sslip.io/v1/screenshot",
    headers=headers,
    json={
        "url": "https://example.com",
        "full_page": True,
        "format": "png",
    },
    timeout=120,
)
res.raise_for_status()
with open("example.png", "wb") as f:
    f.write(res.content)

An iPhone screenshot of one section, as WebP, with the cookie banner hidden and the dark theme on:

curl
curl -X POST https://api.104-236-84-15.sslip.io/v1/screenshot \
  -H "Authorization: Bearer $PAGETEER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/pricing","device":"iphone-15","selector":"#plans","hide_selectors":["#onetrust-banner-sdk",".cookie-notice"],"dark_mode":true,"format":"webp","quality":80}' \
  -o plans.webp
JavaScript (fetch)
const res = await fetch('https://api.104-236-84-15.sslip.io/v1/screenshot', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.PAGETEER_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "url": "https://example.com/pricing",
    "device": "iphone-15",
    "selector": "#plans",
    "hide_selectors": [
      "#onetrust-banner-sdk",
      ".cookie-notice"
    ],
    "dark_mode": true,
    "format": "webp",
    "quality": 80
  }),
});
if (!res.ok) throw new Error((await res.json()).error.message);
const bytes = Buffer.from(await res.arrayBuffer());
await import('node:fs/promises').then(fs => fs.writeFile('plans.webp', bytes));
Python (requests)
import os
import requests

headers = {"Authorization": f"Bearer {os.environ['PAGETEER_API_KEY']}"}
res = requests.post(
    "https://api.104-236-84-15.sslip.io/v1/screenshot",
    headers=headers,
    json={
        "url": "https://example.com/pricing",
        "device": "iphone-15",
        "selector": "#plans",
        "hide_selectors": ["#onetrust-banner-sdk", ".cookie-notice"],
        "dark_mode": True,
        "format": "webp",
        "quality": 80,
    },
    timeout=120,
)
res.raise_for_status()
with open("plans.webp", "wb") as f:
    f.write(res.content)

Device presets

A preset sets the viewport, the device pixel ratio (the image is that many times larger), touch, the mobile layout and a matching user agent: Safari on iPhone and iPad, Chrome on Android and desktop.

Device presets
deviceDeviceViewport (CSS px)Pixel ratio
iphone-seiPhone SE375 × 6672x
iphone-15iPhone 15393 × 8523x
iphone-15-pro-maxiPhone 15 Pro Max430 × 9323x
pixel-8Pixel 8412 × 9152.625x
galaxy-s24Galaxy S24360 × 7803x
ipadiPad (10th gen)820 × 11802x
ipad-proiPad Pro 12.9"1024 × 13662x
laptop-1366Laptop 1366×7681366 × 7681x
macbook-proMacBook Pro 14" (Retina)1512 × 9822x
desktop-1080pDesktop 1920×10801920 × 10801x
desktop-1440pDesktop 2560×14402560 × 14401x

Response

By default the body is the image itself (image/png, image/jpeg or image/webp). The x-tier-used and x-target-status headers say which tier captured it and what the site answered, and x-screenshot-clipped: true that a full-page or element capture was cut at max_height, next to the usual x-credits-used, x-credits-remaining and x-request-id.

Send Accept: application/json to get JSON with the image as base64 instead (what you want in serverless functions, queues or anything that only handles JSON):

200 OK with Accept: application/json
{
  "url": "https://example.com",
  "final_url": "https://example.com/",
  "status": 200,
  "content_type": "image/png",
  "screenshot_base64": "iVBORw0KGgoAAAANSUhEUgAABQAAAAMgCAIAAADz…",
  "clipped": false,
  "tier_used": "none",
  "attempts": [{ "tier": "none", "status": 200, "ms": 905 }],
  "cached": false,
  "credits": 5
}

status is the site's HTTP status. With max_age, cached, cache_age_s and revalidated work as for render.

Hiding cookie banners. Consent banners usually live in a fixed element with a stable id or class: #onetrust-banner-sdk (OneTrust), #CybotCookiebotDialog (Cookiebot), .fc-consent-root (Funding Choices). Hiding one does not accept or reject anything: no click is made and no script of yours runs.

Credits

5 credits, plus the tier that succeeded (stealth +5, residential through your own proxy +0): a stealth screenshot costs 10. Devices, formats, element captures, hidden elements, dark mode and full pages cost the same; very tall pages are cut at max_height instead of costing more. A target 5xx is captured but not charged; cache hits cost 0; selector_not_found is free.

Errors

Screenshot errors
StatusCodeWhenChargedWhat to do
400invalid_requestA parameter is missing, invalid or unknown (the message and error.issues name it).NoFix the request; retrying it unchanged fails again.
401invalid_api_keyNo key, an unknown key, or a revoked or expired key.NoCheck the Authorization header and the key on the API keys page.
402insufficient_creditsNot enough credits left this month for this request, and billable usage is off. error.reason says why: free_credits_used, payment_failed or subscription_inactive.NoAct on the reason at error.billing_url: add a card, update the payment method, or restart the subscription. Or wait for the 1st (UTC).
402spend_limit_reachedBillable usage is on and this month’s spend limit is reached (error.reason: spend_limit).NoRaise the spend limit at error.billing_url (the Billing page), or wait for the 1st (UTC).
403forbidden_targetThe URL is denylisted, resolves (or redirects) to a private or internal address, or sends cookies or credentials to a login, account or checkout page.NoDo not retry. See the Acceptable Use Policy.
403robots_disallowedrespect_robots is on (default for crawl and batch) and the site’s robots.txt disallows the URL for PageteerBot.NoSkip the URL. Turn respect_robots off only for sites you own or may crawl.
403org_suspendedThe account is suspended.NoContact support.
403feature_not_in_planSchema extraction on the free mode or while it is not available on this deployment.NoUse selectors or structured, or add a card.
403proxy_not_configuredunblock "residential" without a team proxy saved in Settings → Proxy (404 from POST /v1/proxy/test).NoSave your proxy URL in Settings → Proxy (see Bring your own proxy), or use another tier.
413payload_too_largeThe request body is over 64 KB (8 MB for POST /v1/batch), or a crawl is too large to export in one file.NoSend less, or split a batch; read a large crawl with GET /v1/crawl/:id.
422target_blockedThe site blocked every tier we tried (with unblock "auto", the tiers this deployment offers). block_reason, block_vendor and attempts say how.NoTry a stronger unblock tier (or "auto"); if auto already failed, retry much later.
422captcha_requiredThe site answered with a CAPTCHA or bot challenge. We never solve them and try no further tier.NoDo not retry soon. Use the site’s API or data feed if it has one.
422login_requiredThe site redirected to a login or sign-in page (final_url says where). We never log in.NoThe content is not public: skip it.
429rate_limitedOver your requests per minute, or too many requests to one site across the platform right now.NoWait Retry-After seconds, then back off with jitter.
429concurrency_limitToo many of your requests are in flight at once.NoWait for one to finish (Retry-After: 1) or lower your parallelism.
429target_rate_limitedThe site asked us to slow down (429, or 503 with Retry-After), or per-site pacing would not let your request start in time. We pause that site for everyone.NoWait error.retry_after seconds (also in Retry-After).
502proxy_failedYour proxy failed: reason "auth" (it rejected the credentials), "unreachable", "status" (it refused the connection) or "blocked" (its host resolves to a private address).NoFix the URL or credentials in Settings → Proxy and test it. "unreachable" and "status" may pass on retry.
500 / 502 / 503internal_errorSomething failed on our side (rendering engine, LLM extraction or the API itself), or the rendering engine is at capacity (503, Retry-After: 5).NoRetry with backoff (honor Retry-After); quote x-request-id if it persists.
504timeoutThe site did not answer within timeout_ms.NoRetry, maybe with a larger timeout_ms or mode "http".
422selector_not_foundA screenshot selector matched no visible element within 5 seconds of the page loading. Not charged.NoCheck the selector against the live page (it may differ by device or need a consent click), or capture the page instead.