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
- Device emulation — desktop, tablet, and mobile viewports
- 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" \
-H "Authorization: Bearer YOUR_API_KEY" \
--output screenshot.pngThat is it. You will get a PNG screenshot of the page saved to screenshot.png.
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",
width: "1280",
height: "720",
}),
{
headers: {
Authorization: "Bearer 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",
"width": 1280,
"height": 720,
},
headers={"Authorization": "Bearer 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 |
width | Viewport width in pixels | 1280 |
height | Viewport height in pixels | 720 |
full_page | Capture the full scrollable page | false |
delay | Wait time in ms before capture | 0 |
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.