# Website Screenshot API: Full Page & Visual Diff (`stas_k/website-screenshot-visual-diff`) Actor

Reviewed complaints under screenshot actors: full page asked, above-the-fold returned; a failed shot still charged. Here fullPage is on by default and the charge fires only after the image is saved. Pixel diff against the previous run of the same URL.

- **URL**: https://apify.com/stas_k/website-screenshot-visual-diff.md
- **Developed by:** [Stas K](https://apify.com/stas_k) (community)
- **Categories:** Developer tools
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $50.00 / 1,000 screenshot pages

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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 API: Full-Page PNG & Visual Diff

**Most screenshot APIs hand you a picture and forget it.** Then you build the rest yourself: a storage
bucket for old images, a diff tool, a scheduler, and a rule for what counts as "changed".
This Actor does that part in the same run: a full-page screenshot, the **share of changed pixels**
against the previous screenshot of the same URL, and a **diff image with the changes painted red**.
The new screenshot becomes the baseline for the next run - automatically.

One call = one page. Nothing to install, nothing to store on your side.

### The pain this removes

| The usual story | What happens here |
|---|---|
| Screenshot taken, change detection left to you | `changed`, `changedRatio` and `diff.png` come back in the same run |
| Baselines on your disk, or silently mixed with other users' | A named store `screenshot-baselines` inside **your own** Apify account, keyed by URL + viewport + format |
| Blank or half-rendered images on JavaScript-heavy sites | Real Chromium, waits for the load event plus `waitFor` ms for lazy images |
| A monthly subscription for a handful of checks | **$0.05 per page, no subscription, no minimum** |
| "It worked" with nothing to prove it | Every run is a dataset row: size, dimensions, timestamp, keys, change ratio |
| Mobile and desktop shots overwriting each other | Viewport and format are part of the baseline key, so each keeps its own history |

### What you get

| Output | Where |
|---|---|
| Change ratio, baseline key, capture metadata | Dataset (`Run result`) |
| Screenshot (PNG or JPEG) | Key-value store, `screenshot.png` |
| Diff image, red = changed pixels | Key-value store, `diff.png` - only when something changed |

Example dataset item:

```json
{
  "url": "https://example.com",
  "changed": false,
  "changedRatio": 0.0,
  "firstRun": false,
  "sizeBytes": 71152,
  "width": 1440,
  "height": 900,
  "fullPage": true,
  "screenshotKey": "shot_2f1a6c1e8b3f0d92",
  "checkedAt": "2026-11-04T12:15:00+00:00"
}
```

When the page differs from the baseline, `changed` is `true`, `changedRatio` holds the share of changed
pixels (for example `0.0853` = 8.53 %) and an extra record `diffKey` points to the diff image.

### Who uses it

- **Price and content monitoring** - watch a product page, a tariff table or a hotel page for edits.
- **Competitor landing pages** - a silent redesign shows up as a change ratio, not as a surprise next month.
- **Terms of service and legal pages** - a timestamped image of what the text said on a given day.
- **Status pages and dashboards** - a picture is the proof when the status API is down.
- **Deploy checks** - your own site after a release, with an alert when the layout breaks.
- **QA of marketing pages** across viewports, without a browser in CI.

### Input

| Field | Default | Meaning |
|---|---|---|
| `url` | - | Page address. `example.com` is accepted and upgraded to `https://`. |
| `fullPage` | `true` | Whole scrollable page, or only the visible screen. |
| `width` / `height` | `1440` / `900` | Viewport in CSS pixels. |
| `format` | `png` | `png` for pixel-perfect detail, `jpeg` for smaller files. |
| `diffPixels` | `12` | How much a colour channel must change (0-255) for a pixel to count. Higher ignores soft noise, lower catches subtle shifts. |
| `waitFor` | `1000` | Extra milliseconds after load, for lazy images and animations. |
| `resetBaseline` | `false` | Forget the stored screenshot for this URL and treat this run as a new baseline. |

### Use it from code

```bash
curl -X POST "https://api.apify.com/v2/acts/YOUR_USER~website-screenshot-visual-diff/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com","fullPage":true}'
```

The response is the dataset item above; the images are in the run's key-value store under the returned keys.
Works with Python, Node, Zapier, Make and n8n through the same endpoint.

### Use it from an AI assistant (MCP)

The Actor is callable as an MCP tool, so Claude, Cursor or any MCP client can check a page directly:
"compare this page with the version from last week" - the assistant runs the Actor and reads the
change ratio instead of guessing.

### Where the baselines live

In a **named key-value store** inside your own Apify account (`screenshot-baselines`). They survive
between runs, they are billed to you at Apify storage prices, and nobody else's baselines are mixed
with yours.

### Pricing

**$0.05 per screenshot page** - one event covers the screenshot and its comparison with the previous
run, no matter how large the page is. No subscription, no minimum. On Apify's free plan the run is covered by the included monthly usage credit,
so no card is needed until that credit runs out.

### Tips for stable results

- Pages with carousels, live counters or ads change every minute - raise `diffPixels` to 20-30 to ignore them.
- Cookie banners appear on the first visit only; run twice with `resetBaseline: false` to get a clean baseline.
- For a long page with lazily loaded images, raise `waitFor` to 3000 ms.
- To watch many pages, run the Actor once per URL via API, a schedule, or an Apify task.

### Limitations

- Pages behind a login or a paywall cannot be captured (no authentication is sent).
- Very long or heavy pages may hit the run timeout; increase the timeout and memory in the run settings.
- The diff is pixel-based, so a 1-pixel layout shift counts as a change across the whole page.

### Feedback

A page that renders badly, or a site that refuses to load? Open an issue on the Actor page with the URL -
that is the fastest way to get it fixed.

#### Spending cap

If you do not set a spending cap, Apify applies its own default (about $4.63 per run). When that cap is reached the run stops early: the remaining items are skipped and you are charged only for what was actually delivered. For a full pass, set `maxTotalChargeUsd` in the run options.

# Actor input Schema

## `url` (type: `string`):

Page address, e.g. https://example.com. The baseline for this URL is kept in your own Apify storage.

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

true = the whole scrollable page, false = only the visible screen.

## `width` (type: `integer`):

Browser window width in CSS pixels. Different widths keep separate baselines.

## `height` (type: `integer`):

Browser window height in CSS pixels. Different heights keep separate baselines.

## `format` (type: `string`):

png keeps pixel-perfect detail, jpeg is smaller. Different formats keep separate baselines.

## `diffPixels` (type: `integer`):

How much a channel must change (0-255) for a pixel to count as changed. Higher = ignores soft noise, lower = catches subtle shifts.

## `waitFor` (type: `integer`):

Time to wait after load, for animations and lazy images.

## `resetBaseline` (type: `boolean`):

true = forget the stored screenshot for this URL and treat this run as a new baseline.

## Actor input object example

```json
{
  "url": "https://example.com",
  "fullPage": true,
  "width": 1440,
  "height": 900,
  "format": "png",
  "diffPixels": 12,
  "waitFor": 1000,
  "resetBaseline": false
}
```

# Actor output Schema

## `results` (type: `string`):

Change ratio, baseline key and metadata of this run.

## `screenshot` (type: `string`):

The captured image. The key is `screenshot.png`, or `screenshot.jpeg` when the input asks for jpeg; the exact key is also in every dataset row as `screenshotKey`.

## `diff` (type: `string`):

Changed pixels highlighted in red. Present only when the page differs from the baseline.

# 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 = {
    "url": "https://example.com"
};

// Run the Actor and wait for it to finish
const run = await client.actor("stas_k/website-screenshot-visual-diff").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 = { "url": "https://example.com" }

# Run the Actor and wait for it to finish
run = client.actor("stas_k/website-screenshot-visual-diff").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 '{
  "url": "https://example.com"
}' |
apify call stas_k/website-screenshot-visual-diff --silent --output-dataset

```

## MCP server setup

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

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/KJlZ1w1PjP59l4usw/builds/Xv69vdiYdYcqmvc6B/openapi.json
