Taking screenshots of websites programmatically is a common requirement for many applications — from generating link previews and building monitoring dashboards to creating visual regression tests. In this guide, we will walk through how to use FastScreenshotAPI to capture pixel-perfect screenshots with just a few lines of code.
Why Use a Screenshot API?
Running your own headless browser infrastructure is complex and expensive. You need to manage Chromium instances, handle timeouts, deal with cookie banners, wait for lazy-loaded content, and scale horizontally when traffic spikes. A screenshot API abstracts all of that away so you can focus on your product.
FastScreenshotAPI handles the hard parts for you:
- Automatic waiting for pages to fully render, including JavaScript-heavy SPAs
- Cookie banner dismissal so you get clean screenshots every time
- Multiple formats — PNG, JPEG, WebP, and PDF
- Desktop and mobile — a 1920×1080 desktop viewport, or a 390×844 mobile viewport with
mobile=true - Full-page capture — not just the visible viewport
Quick Start with cURL
The simplest way to capture a screenshot:
curl "https://api.fastscreenshotapi.com/v1/screenshot?url=https://example.com&format=png&response_type=binary" \
-H "X-Api-Key: YOUR_API_KEY" \
--output screenshot.pngThat is it. You will get a PNG screenshot of the page saved to screenshot.png. Without response_type=binary, the API returns JSON with a signed download URL instead.
JavaScript Example
Using fetch in Node.js or any modern JavaScript environment:
const response = await fetch(
"https://api.fastscreenshotapi.com/v1/screenshot?" +
new URLSearchParams({
url: "https://example.com",
format: "png",
full_page: "true",
response_type: "binary",
}),
{
headers: {
"X-Api-Key": "YOUR_API_KEY",
},
}
);
const buffer = await response.arrayBuffer();
// Save or process the screenshot bufferPython Example
import requests
response = requests.get(
"https://api.fastscreenshotapi.com/v1/screenshot",
params={
"url": "https://example.com",
"format": "png",
"full_page": "true",
"response_type": "binary",
},
headers={"X-Api-Key": "YOUR_API_KEY"},
)
with open("screenshot.png", "wb") as f:
f.write(response.content)Key Parameters
| Parameter | Description | Default |
|---|---|---|
url | The URL to screenshot | Required |
format | Output format: png, jpeg, webp, pdf | png |
mobile | Use a 390×844 mobile viewport and user agent | false |
full_page | Capture the full scrollable page | false |
delay | Extra wait in ms after page load (0–10000) | 3000 |
response_type | url (signed link), binary (raw image), or json (base64) | url |
What's Next?
Check out the API documentation for the full list of parameters, or try it out in the Playground to see results instantly. If you are dealing with cookie consent banners ruining your screenshots, read our guide on how we solved that problem.