How do I take a screenshot of a website with an API?
Send the page URL to GET /v1/screenshot with your secret key. Shotfly opens the page in a real browser, waits for it to load, removes cookie banners and ads, and returns the image in the response body. Every other option, such as the device, the format or a full-page capture, is a query parameter.
curl -G "https://api.shotfly.dev/v1/screenshot" \
--data-urlencode "url=https://example.com" \
-d full_page=true -d format=webp \
-H "Authorization: Bearer $SHOTFLY_SECRET_KEY" \
--fail-with-body -D headers.txt -o page.webpWhich sizes, devices and formats can I capture?
| What | Parameters | Limits |
|---|---|---|
| Viewport | viewport_width, viewport_height | 100–3,840 × 100–2,160 CSS pixels; default 1,280 × 800 |
| Device presets | device | desktop, desktop_hd, iphone_15, pixel_8, ipad |
| Pixel density | device_scale_factor | 1–3; default 1 |
| Full page | full_page, full_page_max_height | 10,000 CSS pixels by default, at most 20,000 |
| Part of the page | selector, or clip_x, clip_y, clip_width, clip_height | The first element that matches, or a rectangle |
| Output | format, quality, thumbnail_width | png (default), jpeg, webp or pdf; WebP is at most 16,383 pixels on each side |
| Dark mode | dark_mode | Emulates prefers-color-scheme: dark |
Does Shotfly charge for failed screenshots?
No. A request costs credits only when Shotfly returns a usable screenshot. Bot challenges, blank pages, HTTP errors, cookie banners or walls that could not be removed, timeouts and errors on Shotfly's side return an error code and cost nothing, and results served from cache are free. The X-Credits-Charged header says what each request cost.
How long can a capture take?
Each request has a time budget of 5 to 60 seconds (timeout, default 30). Within it, Shotfly waits for wait_until (load by default, or domcontentloaded or networkidle), for wait_for_selector when you set one, and for delay (up to 10 seconds). For batches or slow pages, queue the captures with async jobs and receive each result by webhook.
Can I capture pages behind a login?
Yes, when you can hand the session to the browser: cookies takes a JSON array of {name, value, domain?, path?}, and headers adds request headers such as Authorization. Shotfly does not fill in login forms. Use an account made for this rather than a personal session.
What can't it capture?
- Private and internal addresses: localhost, private networks and cloud metadata addresses are refused with
url_not_allowed, including when a page redirects there during the render. - Sites that block automated browsers: the request fails with
target_blockedand costs nothing.escalation=autolets Shotfly retry on its premium anti-bot tier, but some sites block every automated browser. - Video or animation: the output is a still image or a PDF.
- Full-page captures taller than 20,000 CSS pixels: the capture stops at
full_page_max_height. - More than 2 MB of raw markup in the
htmlfield.

