Skip to main content
Every example on this page sends a JSON body to POST https://screenshotly.app/api/screenshot with your key in the x-api-key header. Options marked Basic, Growth, or Scale need that plan or higher; see the request reference for every field and bound.

Basic capture

Without other options you get a 1920 × 1080 PNG of the first screen of the page. The remaining examples show only the JSON body; send it with any of the clients above.

Viewport and devices

Use a device preset or set width and height together:
  • device takes precedence: if it is set, width and height are ignored.
  • width (320–3,840) and height (240–3,840) only apply when both are present.
  • Presets change the viewport size only, so sites see a narrow window rather than a mobile browser. Set userAgent as well if a site serves different markup to mobile user agents.
  • deviceScaleFactor (1–3) renders at higher pixel density. At 2, a 1440 × 900 viewport produces a 2880 × 1800 image.

Output formats

A PDF always contains the whole document across as many A4 pages as needed, so fullPage has no effect on it. For many PDFs, or PDFs of slow pages, use an async job instead of holding the request open.

Full-page and partial captures

  • fullPage captures the whole scrollable height at the viewport’s width.
  • selector captures the first matching element’s bounding box. If nothing matches, the request fails with 400 Invalid screenshot options.
  • clip captures a fixed rectangle in CSS pixels; it wins if you also send selector.

Wait for dynamic content

By default the capture starts when the HTML document has loaded (DOMContentLoaded). Single-page apps, charts, and lazy images often need more time:
scroll scrolls the page in steps before capturing (distance 100–50,000 px, default 5,000; speed 100–5,000 px per second, default 500), then returns to the top. Scrolling adds roughly distance ÷ speed seconds to the capture, so keep it short for synchronous requests or use an async job.

Clean up the page

Ads and known elements

blockAds (all plans) blocks common ad networks and hides common ad containers. hideSelectors (Growth) hides up to 100 elements you name:

AI element removal

aiRemoval (Growth) finds overlays you have not named. Screenshotly lists fixed and sticky elements, plus elements whose ID, class, role, or label suggests a banner or widget, asks an AI model to classify them, and removes the matches before capturing.
  • Omit types, or send an empty list, to consider all five.
  • confidence (0–1, default 0.8) is the minimum score for removal. Raise it to remove less and avoid false positives; lower it to remove more.
  • The model is instructed not to select the page’s html, body, main content, navigation, or ordinary controls, but check results on pages you capture often. When you know the selector, hideSelectors is faster and deterministic.

Appearance and locale

  • darkMode emulates prefers-color-scheme: dark. It only changes sites that support a dark theme.
  • timezone takes an IANA name such as Europe/Berlin.
  • geolocation (Growth) sets the browser’s reported location: { "latitude": 51.5072, "longitude": -0.1276 }. Sites that locate visitors by IP address are not affected; regional IPs are available with proxyRegion (Scale).
  • headers and cookies are Basic features.

Pages behind a login

Pass a session with cookies or headers (Basic):
A cookie’s domain must be the target host or a parent domain of it. Use a dedicated, low-privilege account; see Security.

Custom JavaScript

javascript (Growth) runs up to 5,000 characters of code in the page after it loads and before the capture, for example to open a tab or remove an element:
If the script throws, the capture continues without it, so check the output when you change a script.

Handle errors and retries

Retry only when a retry can succeed:
Node.js
Failed requests do not consume your capture allowance, but every validated request counts toward per-minute throughput. See Authentication.

Next steps