# Website Screenshot Generator (`datapilot/website-screenshot-generator`) Actor

Supports custom viewport dimensions, full-page or viewport screenshots, PNG/JPEG formats, configurable loading delays, Apify Proxy integration. Saves screenshot images to the Apify Key-Value Store and screenshot URLs, capture status, website details, dimensions, and timestamps to the Apify Dataset.

- **URL**: https://apify.com/datapilot/website-screenshot-generator.md
- **Developed by:** [Data Pilot](https://apify.com/datapilot) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 88.9% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 captured website screenshots

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

📸 **Website Screenshot Generator** is a powerful Apify Actor designed to capture a **Website Screenshot** of any public web page in a real headless Chromium browser. This tool provides **Website Screenshot** output including PNG or JPEG images, full-page or viewport captures, custom viewport sizes, and a dataset record for every URL with its status and image link. Whether you're archiving pages, monitoring visual changes, generating thumbnails, or documenting a site for reports, the Website Screenshot Generator delivers reliable results efficiently.

With multiple URLs per run, adjustable viewport size, full-page mode, a configurable wait before capture, image format choice, and Apify Dataset and Key-Value Store delivery, this **Website Screenshot** actor makes bulk screenshot capture simple. It records a success or failure status for each URL, so you always know which **Website Screenshot** worked.

***

### 📋 Table of Contents

- [Features](#-features)
- [Data Source](#-data-source)
- [How It Works](#-how-it-works)
- [Input](#-input)
- [Output](#-output)
- [Technical Stack](#-technical-stack)
- [Data Fields](#-data-fields-explained)
- [Use Cases](#-use-cases)
- [Quick Start](#-quick-start)
- [Configuration](#-configuration)
- [Performance](#-performance)
- [Important Notes](#-important-notes)
- [License & Legal](#-license--legal)

***

### 🔥 Features

- **Real Browser Rendering** – Loads each page in headless Chromium (Playwright), so JavaScript-rendered content is captured. This is the core of **Website Screenshot** generation.
- **Multiple URLs per Run** – Capture a list of pages in one run.
- **Full-Page or Viewport Capture** – Capture only the visible area or the entire scrollable page with `fullPage`.
- **Custom Viewport Size** – Set `viewportWidth` and `viewportHeight` (default 1920×1080).
- **PNG or JPEG** – Choose the image format with `imageFormat`.
- **Configurable Wait** – Wait before capturing so content has time to render (`delaySeconds`).
- **Automatic URL Fixing** – Adds `https://` to URLs that have no scheme.
- **Per-URL Status** – Each URL gets a `SUCCESS` or `FAILED` record with an error message when it fails.
- **Image Storage** – Saves every image in the run's Key-Value Store and gives you a link.
- **Basic Anti-Detection Settings** – Hides the common browser automation flag.
- **Apify Proxy Support** – Optional Apify Proxy for the headless browser.
- **Detailed Logging** – Logs progress for every **Website Screenshot** captured.

***

### 📊 Data Source

#### **The URLs You Provide**

- **Source**: Any public web page URL you list in `urls`
- **Access Method**: Headless Chromium via Playwright, with optional Apify Proxy
- **Coverage**: Pages that a normal browser can open without logging in
- **Output**: An image per URL, saved in the run's Key-Value Store, plus one Dataset record per URL
- **Access**: No login or API key used

***

### ⚙️ How It Works

The Website Screenshot Generator accepts a list of URLs and capture settings. It starts one headless Chromium browser, opens each URL in turn, waits for the page to render, takes the screenshot, saves the image to the Key-Value Store, and records the outcome. All records are pushed to the Apify Dataset as one batch at the end.

**Key Processing Steps:**

1. **Input Parsing** – Read `urls`, `fullPage`, `viewportWidth`, `viewportHeight`, `delaySeconds`, and `imageFormat`
2. **URL Cleaning** – Remove empty entries and add `https://` where missing
3. **Proxy Setup** – Configure Apify Proxy if enabled
4. **Browser Launch** – Start headless Chromium with your viewport size
5. **Page Load** – Open each URL and wait for the page to start loading, then wait the configured delay (at least 2 seconds)
6. **Capture** – Take the screenshot (full page or viewport) as PNG or JPEG
7. **Storage** – Save the image to the Key-Value Store and build its link
8. **Record Building** – Create one record per URL with status and details
9. **Dataset Push** – Push all **Website Screenshot** records at once

***

### 📥 Input

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `urls` | array | `["https://gemini.google.com/"]` | Pages to capture. `https://` is added if missing. |
| `fullPage` | boolean | `false` | Capture the full scrollable page instead of just the viewport. |
| `viewportWidth` | integer | `1920` | Browser width in pixels. |
| `viewportHeight` | integer | `1080` | Browser height in pixels. |
| `delaySeconds` | number | `3.0` | Seconds to wait after the page starts loading before capturing (minimum 2). |
| `imageFormat` | string | `"png"` | `"png"` or `"jpeg"`. Any other value falls back to `png`. |
| `proxyConfiguration` | object | `{"useApifyProxy": true}` | Apify Proxy configuration. |

**Example Input:**

```json
{
  "urls": ["https://example.com", "https://apify.com"],
  "fullPage": true,
  "viewportWidth": 1440,
  "viewportHeight": 900,
  "delaySeconds": 4,
  "imageFormat": "png"
}
```

**Mobile-Sized Viewport:**

```json
{
  "urls": ["https://example.com"],
  "viewportWidth": 390,
  "viewportHeight": 844,
  "imageFormat": "jpeg"
}
```

***

### 📤 Output

One **Website Screenshot** record is pushed per URL:

| Field | Type | Description |
|-------|------|-------------|
| `url` | string | The URL that was captured |
| `status` | string | `SUCCESS` or `FAILED` |
| `screenshotKey` | string or null | Key of the image in the Key-Value Store (`null` if failed) |
| `screenshotUrl` | string or null | Link to the image in the run's Key-Value Store (`null` if failed) |
| `fullPage` | boolean | Whether full-page mode was on |
| `width` | integer | Viewport width used |
| `height` | integer | Viewport height used |
| `format` | string | `png` or `jpeg` |
| `capturedAt` | string | ISO 8601 UTC timestamp |
| `errorMessage` | string or null | Error text when the capture failed |

Image keys look like `example_com_1.png`: the domain, the position of the URL in your list, and the file extension.

**Example Website Screenshot Record:**

```json
{
  "url": "https://example.com",
  "status": "SUCCESS",
  "screenshotKey": "example_com_1.png",
  "screenshotUrl": "https://api.apify.com/v2/key-value-stores/<STORE_ID>/records/example_com_1.png",
  "fullPage": true,
  "width": 1440,
  "height": 900,
  "format": "png",
  "capturedAt": "2026-10-30T09:00:00+00:00",
  "errorMessage": null
}
```

***

### 🧰 Technical Stack

- **Browser:** Playwright with headless Chromium
- **Storage:** Apify Key-Value Store for images, Apify Dataset for records
- **Proxy:** Apify Proxy, optional via `useApifyProxy`
- **Logging:** Apify Actor logging system
- **Platform:** Apify Actor serverless environment

***

### 📊 Data Fields Explained

- **url / status / errorMessage**: Which page, whether the capture worked, and why not if it failed
- **screenshotKey / screenshotUrl**: Where to find the image
- **fullPage / width / height / format**: The settings used for the capture
- **capturedAt**: When the capture was taken

***

### 🎯 Use Cases

- **Visual Archiving** – Keep dated images of web pages
- **Change Monitoring** – Capture pages on a schedule and compare them
- **Thumbnails & Previews** – Generate preview images for links or directories
- **QA & Responsive Testing** – Capture pages at different viewport sizes
- **Reports & Documentation** – Add page screenshots to reports and audits
- **Competitor & Ad Research** – Record how public pages look at a point in time

***

### 🚀 Quick Start

#### **1. Prepare Input**

Go to Apify Console and enter:

```json
{
  "urls": ["https://example.com"],
  "fullPage": false
}
```

#### **2. Run the Actor**

Click **Start**. The Actor will:

- Launch headless Chromium
- Open each URL and wait for it to render
- Capture and store each **Website Screenshot**
- Push one record per URL to the Dataset

#### **3. Monitor Progress**

Console shows:

```
🛡️ Apify Proxy connected for headless browser.
📸 Preparing to capture screenshots for 1 URL(s)...
[1/1] Loading: https://example.com
✅ Successfully captured: example_com_1.png
🎉 Successfully captured and pushed 1 record(s) to dataset!
Done!
```

#### **4. View & Download Results**

- **Dataset Tab**: One record per URL with status and image link
- **Key-Value Store Tab**: The image files, which you can download
- **Export**: Dataset as JSON, CSV, Excel, or HTML
- **API Access**: Available via the Apify API

***

### ⚙️ Configuration

Full-page capture:

```json
{
  "urls": ["https://example.com/long-page"],
  "fullPage": true
}
```

Slow pages, longer wait:

```json
{
  "urls": ["https://example.com/dashboard"],
  "delaySeconds": 8
}
```

Direct connection without proxy:

```json
{
  "urls": ["https://example.com"],
  "proxyConfiguration": { "useApifyProxy": false }
}
```

***

### 📈 Performance

#### **Processing Speed**

- URLs are processed one after another in a single browser
- Each page takes at least the wait time (minimum 2 seconds) plus load and capture time
- Navigation times out after 25 seconds, and the screenshot step after 15 seconds

#### **Resource Usage**

- Memory: Higher than HTTP-only Actors because a real browser runs. Full-page captures of very long pages use more memory.
- Network: Loads each page fully, except media files, which are blocked
- Proxy: Optional Apify Proxy

***

### ⚠️ Important Notes

#### **Legal & Compliance**

- **Public Pages Only**: Capture only pages you are allowed to access. Do not use the Actor on pages behind a login or on private content.
- **robots.txt and Terms**: The Actor does not check robots.txt. Respect each site's terms of service.
- **Copyright & Privacy**: Screenshots may contain copyrighted material or personal data. Store and share them responsibly.
- **Legal**: Not legal advice

#### **Data Quality**

- **SUCCESS Means a Screenshot Was Taken**: If a page fails to finish loading within the navigation timeout, the Actor logs a note and still captures whatever is on screen, and the record is marked `SUCCESS`. Always check important images, since a slow or blocked page can produce a blank or partial screenshot.
- **Popups & Banners**: The Actor does not dismiss cookie banners, popups, or consent dialogs, so they can appear in the image.
- **Blocking & Captchas**: Some sites block automated browsers or show a captcha. Basic anti-detection settings are used, but results are not guaranteed.
- **Image Access**: `screenshotUrl` points to the image in the run's Key-Value Store. Whether others can open it depends on your Apify storage access settings, and run storages are kept according to Apify's data retention rules. Download images you need to keep.
- **Proxy Failures**: The Actor falls back to a direct connection only if the proxy cannot be configured. If the proxy is configured but fails during loading, that URL may end as `FAILED`.
- **Freshness**: Each image shows the page at the moment of capture

#### **Best Practices**

- Increase `delaySeconds` for pages that load content slowly
- Use `fullPage` only when you need the whole page
- Use the same viewport size across runs when comparing images over time
- Check the `status` and `errorMessage` fields before using an image

***

### 📄 License & Legal

**Terms of Use:**

- Use for legitimate archiving, monitoring, testing, and documentation purposes
- Respect the terms of service of the sites you capture
- Do not use for unlawful or unauthorized capture of private content
- Use data responsibly and in compliance with applicable laws

**Disclaimer:**
Website Screenshot Generator is provided as-is for informational and testing purposes. Users are responsible for compliance with all applicable laws and the terms of the websites they capture. This is not legal advice.

***

### ⚖️ Website Screenshot Excellence

This Actor is optimized for **Website Screenshot** capture with:

- ✅ Real headless Chromium rendering
- ✅ Full-page and viewport modes
- ✅ Custom viewport size and PNG or JPEG output
- ✅ Per-URL success and failure records
- ✅ Image storage with direct links
- ✅ Production-ready code

# Actor input Schema

## `urls` (type: `array`):

List of URLs to capture screenshots from.

## `fullPage` (type: `boolean`):

Capture the entire scrollable page height instead of just the visible viewport.

## `viewportWidth` (type: `integer`):

Browser screen width in pixels.

## `viewportHeight` (type: `integer`):

Browser screen height in pixels.

## `delaySeconds` (type: `number`):

Seconds to wait after page load before taking the screenshot (useful for animations or JS assets).

## `imageFormat` (type: `string`):

Format of the generated screenshot.

## `proxyConfiguration` (type: `object`):

Apify Proxy configuration (residential or datacenter).

## Actor input object example

```json
{
  "urls": [
    "https://www.google.com"
  ],
  "fullPage": true,
  "viewportWidth": 1920,
  "viewportHeight": 1080,
  "delaySeconds": 3,
  "imageFormat": "png",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `crawlResults` (type: `string`):

No description

## `screenshotsOverview` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "urls": [
        "https://www.google.com"
    ],
    "viewportWidth": 1920,
    "viewportHeight": 1080
};

// Run the Actor and wait for it to finish
const run = await client.actor("datapilot/website-screenshot-generator").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "urls": ["https://www.google.com"],
    "viewportWidth": 1920,
    "viewportHeight": 1080,
}

# Run the Actor and wait for it to finish
run = client.actor("datapilot/website-screenshot-generator").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "urls": [
    "https://www.google.com"
  ],
  "viewportWidth": 1920,
  "viewportHeight": 1080
}' |
apify call datapilot/website-screenshot-generator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,datapilot/website-screenshot-generator"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/hhwzufN7qqip6IXpN/builds/OZYNmO3y0zCLvi9UH/openapi.json
