# Website Screenshot API (`busy_courtyard/website-screenshot`) Actor

Capture full-page or viewport screenshots of public web pages as PNG or JPEG. Set viewport, device, wait time and format; each image is saved with a link in the dataset.

- **URL**: https://apify.com/busy_courtyard/website-screenshot.md
- **Developed by:** [Cole Cassel](https://apify.com/busy_courtyard) (community)
- **Categories:** Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## 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

Turn a list of URLs into clean, full-page **PNG or JPEG screenshots** taken with a real Chromium browser. The actor scrolls each page so lazy images load, keeps sticky headers from repeating down the image, and hides most cookie banners. Every result row includes a direct link to its image.

You pay **$0.002 per successful screenshot**. Errors, 404 pages and block pages are free.

### What it does

- Opens each URL in headless Chromium (Playwright) with a **desktop, laptop, tablet or mobile** viewport, or a custom size.
- Waits for the page to load, then scrolls through it so lazy-loaded images appear. The scroll has a time limit.
- Fixes sticky and fixed headers so they don't repeat in full-page shots, and hides common cookie/consent banners. You can also hide your own CSS selectors.
- Saves a **full-page or viewport** screenshot as PNG, or as JPEG with adjustable quality, to the run's key-value store.
- Returns one dataset row per URL: final URL after redirects, HTTP status, page title, image URL, size and load time.
- Is polite by default:
  - respects `robots.txt`;
  - waits between requests to the same site;
  - identifies itself in the User-Agent (`WebsiteScreenshotBot/1.0`).
- Never tries to get past CAPTCHAs or anti-bot pages. If a page looks like one, the row is marked `possiblyBlocked: true` and isn't charged.

### Use cases

- Visual archives of your own sites or competitors' public pages.
- Thumbnails for link directories, newsletters and dashboards.
- Before and after evidence for website redesigns, QA and regression checks.
- Proof that a public page showed certain content at a given time.
- Feeding page images to AI or vision models.

### Input

Only `startUrls` is required. Everything else has a sensible default.

```json
{
  "startUrls": [
    { "url": "https://example.com" },
    { "url": "https://www.python.org" }
  ],
  "devicePreset": "desktop",
  "fullPage": true,
  "format": "png",
  "maxConcurrency": 3
}
```

| Field | Default | Notes |
|---|---|---|
| `devicePreset` | `desktop` | `desktop` 1920×1080, `laptop` 1366×768, `tablet` (iPad Mini), `mobile` (iPhone 13), or `custom` with `viewportWidth`/`viewportHeight` |
| `fullPage` | `true` | `false` captures only the visible viewport |
| `format` / `jpegQuality` | `png` / 80 | JPEG files are much smaller |
| `waitUntil` / `delayMs` | `load` / 1000 | `networkidle` suits busy single-page apps |
| `scrollToLoadLazyContent` / `maxScrollSeconds` | `true` / 10 | |
| `fixStickyHeaders`, `hideCookieBanners` | `true` | `hideSelectors` takes extra CSS selectors to hide |
| `darkMode` | `false` | Asks the page for its dark color scheme |
| `maxPageHeight` | 16000 px | Very long pages are cut at this height |
| `respectRobotsTxt` | `true` | Turn it off only for sites you own or are allowed to capture |
| `maxConcurrency` / `minDelayBetweenRequestsSecs` | 3 / 1 s | |
| `navigationTimeoutSecs` / `maxRetries` | 45 s / 2 | Retries use exponential backoff on timeouts and on 429/5xx |

### Output

Real rows from a test run on 2026-10-18. On Apify, `screenshotUrl` is a public link to the image in the run's key-value store.

```json
{
  "url": "https://www.python.org",
  "ok": true,
  "finalUrl": "https://www.python.org/",
  "httpStatus": 200,
  "title": "Welcome to Python.org",
  "screenshotUrl": "https://api.apify.com/v2/key-value-stores/<store-id>/records/www.python.org-1ab11d99.png",
  "screenshotKey": "www.python.org-1ab11d99.png",
  "format": "png",
  "width": 1920,
  "height": 2546,
  "bytes": 403009,
  "fullPage": true,
  "devicePreset": "desktop",
  "possiblyBlocked": false,
  "charged": true,
  "loadTimeMs": 3219,
  "attempts": 1,
  "processedAt": "2026-10-18T19:04:01Z"
}
```

A URL that can't be captured produces an error row. It is never charged and doesn't stop the run:

```json
{
  "url": "https://www.google.com/search?q=apify",
  "ok": false,
  "error": {
    "code": "ROBOTS_DISALLOWED",
    "message": "Blocked by https://www.google.com/robots.txt (robots.txt rules). Set respectRobotsTxt to false only for sites you own or have permission to access."
  },
  "attempts": 1,
  "processedAt": "2026-10-18T19:04:13Z"
}
```

Error codes:

- `INVALID_URL`, `PRIVATE_ADDRESS` (localhost or internal networks are refused), `DNS_ERROR`, `ROBOTS_DISALLOWED`;
- `TIMEOUT`, `NETWORK_ERROR`, `SSL_ERROR`, `HTTP_<status>` (a 429/5xx that persisted after retries);
- `DOWNLOAD_NOT_PAGE` (the URL is a file download), `BROWSER_ERROR`, `UNEXPECTED_ERROR`.

In the test run, 13 URLs were processed in 20 seconds:

- 10 charged screenshots of gov.uk, BBC News, Wikipedia, NASA, WHO and others, ranging from 1,080 to 16,000 px tall;
- one 404 page, captured but free;
- one robots.txt block;
- one refused localhost URL.

### Pricing

Pay per event:

| Event | Price |
|---|---|
| Successful screenshot | **$0.002** ($2 per 1,000) |
| Run start (Apify standard) | $0.00005 per GB of memory |

You don't pay for error rows, 4xx/5xx pages or pages flagged as blocked. Apify platform usage is included in the price. You can set a maximum cost per run, and the actor stops cleanly when it is reached.

### Limits

- Pages behind logins, paywalls or CAPTCHAs are not supported, and that is intentional.
- Pages taller than `maxPageHeight` (16,000 px by default) are cut. Very tall PNGs can be several MB; the NASA homepage was about 5 MB.
- Cookie-banner hiding uses common selectors and covers most sites, but not all of them.
- Up to 5,000 URLs per run. Memory defaults to 4 GB, which comfortably runs 3 browser tabs at once.

### FAQ

**Why was a page not charged?**
Its HTTP status was 400 or higher, it looked like a bot-check page, or it failed. Look at `charged`, `httpStatus` and `error` in the row.

**Can it screenshot pages behind a login?**
No. It only captures public pages.

**Why is `robots.txt` respected by default?**
It is the site owner's stated wish about automated access. You can switch it off for sites you own or have permission to capture.

**How do I get the image files?**
Each row's `screenshotUrl` is a direct download link. All images are also in the run's key-value store.

**Can I get JPEGs for smaller files?**
Yes. Set `format` to `jpeg` and choose a `jpegQuality`. Mobile viewport JPEGs at quality 70 were about 150 KB in testing.

# Actor input Schema

## `startUrls` (type: `array`):

Pages to capture. Each URL becomes one PNG/JPEG in the key-value store and one row in the dataset. If you leave out the scheme, https:// is assumed.

## `devicePreset` (type: `string`):

Screen size to emulate. Desktop is 1920×1080 and laptop 1366×768. Tablet (iPad Mini) and mobile (iPhone 13) also set a matching user agent and pixel density. Choose 'custom' to use the width and height below.

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

Only used when Device is 'custom'.

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

Only used when Device is 'custom'.

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

Capture the whole scrollable page instead of just the visible screen.

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

PNG is lossless. JPEG files are much smaller.

## `jpegQuality` (type: `integer`):

Ignored for PNG.

## `waitUntil` (type: `string`):

When the page counts as loaded. 'load' suits most sites. 'networkidle' waits for background requests to stop, which is slower but helps single-page apps.

## `delayMs` (type: `integer`):

Wait this long after loading so animations and fonts can settle.

## `scrollToLoadLazyContent` (type: `boolean`):

Full-page only. Scroll to the bottom and back up so lazy-loaded images appear.

## `maxScrollSeconds` (type: `integer`):

Stops infinite-scroll pages from scrolling forever.

## `fixStickyHeaders` (type: `boolean`):

Full-page only. Stops fixed or sticky headers and chat widgets from floating over the content.

## `hideCookieBanners` (type: `boolean`):

Hide common cookie-consent pop-ups (OneTrust, Cookiebot, Usercentrics, Didomi, ...) with CSS. Nothing is clicked or accepted.

## `hideSelectors` (type: `array`):

For example '.newsletter-popup' or '#chat-widget'.

## `darkMode` (type: `boolean`):

Ask the page for its dark theme (prefers-color-scheme: dark).

## `maxPageHeight` (type: `integer`):

Taller pages are cropped to this height.

## `respectRobotsTxt` (type: `boolean`):

Skip URLs that the site's robots.txt disallows for this bot. Turn it off only for sites you own or have permission to capture.

## `maxConcurrency` (type: `integer`):

How many pages to capture at once. Each needs about 300–500 MB of memory.

## `minDelayBetweenRequestsSecs` (type: `number`):

Minimum time between two pages on the same site. A robots.txt Crawl-delay overrides it if it is longer.

## `navigationTimeoutSecs` (type: `integer`):

Maximum time to load one page.

## `maxRetries` (type: `integer`):

Retries for timeouts, 429 and 5xx errors. Retries use exponential backoff.

## `selfTest` (type: `boolean`):

Ignore the other fields (startUrls is still required by the form, any URL will do) and take one screenshot of example.com, then fail the run if the image or key fields are missing. Meant for a daily health-check schedule.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://example.com"
    },
    {
      "url": "https://www.python.org"
    }
  ],
  "devicePreset": "desktop",
  "viewportWidth": 1920,
  "viewportHeight": 1080,
  "fullPage": true,
  "format": "png",
  "jpegQuality": 80,
  "waitUntil": "load",
  "delayMs": 1000,
  "scrollToLoadLazyContent": true,
  "maxScrollSeconds": 10,
  "fixStickyHeaders": true,
  "hideCookieBanners": true,
  "hideSelectors": [],
  "darkMode": false,
  "maxPageHeight": 16000,
  "respectRobotsTxt": true,
  "maxConcurrency": 3,
  "minDelayBetweenRequestsSecs": 1,
  "navigationTimeoutSecs": 45,
  "maxRetries": 2,
  "selfTest": false
}
```

# Actor output Schema

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

One row per result in the default dataset.

## `screenshots` (type: `string`):

Screenshot images (PNG/JPEG) in the default key-value store.

# 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 = {
    "startUrls": [
        {
            "url": "https://example.com"
        },
        {
            "url": "https://www.python.org"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("busy_courtyard/website-screenshot").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 = { "startUrls": [
        { "url": "https://example.com" },
        { "url": "https://www.python.org" },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("busy_courtyard/website-screenshot").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 '{
  "startUrls": [
    {
      "url": "https://example.com"
    },
    {
      "url": "https://www.python.org"
    }
  ]
}' |
apify call busy_courtyard/website-screenshot --silent --output-dataset

```

## MCP server setup

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

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/sOR3YiKQ7gGHqctWb/builds/t9cm8y9kdBBSXiaUj/openapi.json
