# Website Screenshot API - Page Screenshot Generator (`code-node-tools/website-screenshot-api`) Actor

Website screenshot API to capture any webpage as an image. This screenshot API supports full page, viewport, and element screenshots. Website screenshot generator API for automated website screenshot capture, visual testing, monitoring, and thumbnail generation. Reliable page screenshot API.

- **URL**: https://apify.com/code-node-tools/website-screenshot-api.md
- **Developed by:** [CodeNodeTools](https://apify.com/code-node-tools) (community)
- **Categories:** Developer tools, Other, Automation
- **Stats:** 7 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$10.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period.You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#rental-actors

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Website Screenshot API

Capture high-quality **website screenshots** programmatically with this powerful **screenshot API**. Generate full-page, viewport, or element-specific screenshots of any webpage using Playwright browser automation.

### What is Website Screenshot API?

This **website screenshot generator API** is an Apify Actor that captures pixel-perfect screenshots of any URL. Whether you need a simple **page screenshot API** for monitoring, a **website screenshot generator** for thumbnails, or automated visual testing — this tool handles it all.

#### Key Features

- **Full Page Screenshots** - Capture entire scrollable pages
- **Viewport Screenshots** - Screenshot only the visible area
- **Element Screenshots** - Target specific page elements with CSS selectors
- **Batch Processing** - Screenshot multiple URLs in a single run
- **Mobile Emulation** - Test responsive designs
- **Dark Mode Support** - Capture dark theme variants
- **Lazy Loading Support** - Auto-scroll to load dynamic content
- **Element Removal** - Hide cookie banners, popups, and ads
- **Proxy Support** - Bypass geo-restrictions and avoid blocking

### Use Cases

#### Website Monitoring
Track visual changes on websites over time. Perfect for detecting layout breaks, content updates, or competitor changes.

#### Visual Testing & QA
Automate screenshot capture across different viewports and devices for regression testing.

#### Thumbnail Generation
Create website previews and thumbnails for link previews, portfolios, or directories.

#### Social Media Previews
Generate Open Graph images and social media cards from web content.

#### Documentation
Capture clean screenshots for product documentation, tutorials, and marketing materials.

#### Archiving
Create visual archives of web pages for compliance, legal, or historical purposes.

### Input Parameters

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `url` | string | - | Single URL to screenshot |
| `urls` | array | - | Multiple URLs for batch processing |
| `screenshotType` | string | `fullPage` | Type: `fullPage`, `viewport`, or `element` |
| `selector` | string | - | CSS selector for element screenshots |
| `format` | string | `png` | Image format: `png` or `jpeg` |
| `quality` | integer | `80` | JPEG quality (0-100) |
| `width` | integer | `1920` | Viewport width in pixels |
| `height` | integer | `1080` | Viewport height in pixels |
| `deviceScaleFactor` | number | `1` | Scale factor (2 for retina) |
| `isMobile` | boolean | `false` | Enable mobile emulation |
| `waitForSelector` | string | - | Wait for element before capture |
| `waitForTimeout` | integer | `0` | Additional wait time (ms) |
| `waitUntil` | string | `load` | Page load state to wait for |
| `removeElements` | array | - | Selectors of elements to remove |
| `scrollToBottom` | boolean | `false` | Scroll for lazy-loaded content |
| `darkMode` | boolean | `false` | Enable dark color scheme |
| `proxyConfiguration` | object | - | Proxy settings |

### Example Input

#### Basic Screenshot
```json
{
    "url": "https://example.com",
    "screenshotType": "fullPage",
    "format": "png"
}
````

#### Batch Screenshots with Custom Viewport

```json
{
    "urls": [
        "https://example.com",
        "https://github.com",
        "https://apify.com"
    ],
    "width": 1440,
    "height": 900,
    "format": "jpeg",
    "quality": 90
}
```

#### Element Screenshot

```json
{
    "url": "https://example.com",
    "screenshotType": "element",
    "selector": ".hero-section",
    "removeElements": [".cookie-banner", ".chat-widget"]
}
```

#### Mobile Screenshot with Dark Mode

```json
{
    "url": "https://example.com",
    "width": 390,
    "height": 844,
    "isMobile": true,
    "darkMode": true,
    "deviceScaleFactor": 2
}
```

### Output

Each screenshot generates a dataset item with:

```json
{
    "url": "https://example.com",
    "screenshotUrl": "https://api.apify.com/v2/key-value-stores/.../records/screenshot-0",
    "screenshotKey": "screenshot-0",
    "format": "png",
    "width": 1920,
    "height": 1080,
    "screenshotType": "fullPage",
    "timestamp": "2024-01-15T10:30:00.000Z",
    "success": true
}
```

### API Integration

#### Using the Apify API

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });

const run = await client.actor('YOUR_USERNAME/website-screenshot-api').call({
    url: 'https://example.com',
    screenshotType: 'fullPage',
    format: 'png'
});

// Get screenshot URL from dataset
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log('Screenshot URL:', items[0].screenshotUrl);
```

#### Using cURL

```bash
curl -X POST "https://api.apify.com/v2/acts/YOUR_USERNAME~website-screenshot-api/runs?token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com", "format": "png"}'
```

### Performance Tips

1. **Use viewport screenshots** when you don't need the full page — they're faster
2. **Block unnecessary resources** if you only need the layout
3. **Set appropriate timeouts** for slow-loading sites
4. **Use batch processing** for multiple URLs instead of separate runs
5. **Enable proxy** for sites that block datacenter IPs

### Limitations

- Maximum screenshot dimensions depend on available memory
- Some sites may block automated browsers
- JavaScript-heavy sites may need longer wait times
- Rate limiting may apply to target websites

### Support

- [Apify Documentation](https://docs.apify.com)
- [Crawlee Documentation](https://crawlee.dev)
- [Playwright Documentation](https://playwright.dev)

### License

ISC

# Actor input Schema

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

URL of the webpage to screenshot

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

Multiple URLs for batch screenshot capture

## `screenshotType` (type: `string`):

Type of screenshot to capture

## `selector` (type: `string`):

CSS selector for element screenshot (only used when screenshotType is 'element')

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

Output image format

## `quality` (type: `integer`):

JPEG quality (0-100, ignored for PNG)

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

Viewport width in pixels

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

Viewport height in pixels

## `deviceScaleFactor` (type: `number`):

Device scale factor (1 = normal, 2 = retina)

## `isMobile` (type: `boolean`):

Emulate mobile device

## `waitForSelector` (type: `string`):

CSS selector to wait for before taking screenshot

## `waitForTimeout` (type: `integer`):

Additional wait time in milliseconds before screenshot

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

Wait until page reaches this state

## `removeElements` (type: `array`):

CSS selectors of elements to remove before screenshot (e.g., cookie banners)

## `scrollToBottom` (type: `boolean`):

Scroll to bottom to trigger lazy loading before screenshot

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

Enable dark mode if site supports it

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

Proxy settings for the browser

## Actor input object example

```json
{
  "url": "https://example.com",
  "screenshotType": "fullPage",
  "format": "png",
  "quality": 90,
  "width": 1920,
  "height": 1080,
  "deviceScaleFactor": 1,
  "isMobile": false,
  "waitForTimeout": 0,
  "waitUntil": "load",
  "scrollToBottom": false,
  "darkMode": false,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `screenshots` (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 = {
    "url": "https://example.com",
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("code-node-tools/website-screenshot-api").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",
    "proxyConfiguration": { "useApifyProxy": False },
}

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

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call code-node-tools/website-screenshot-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=code-node-tools/website-screenshot-api",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Website Screenshot API - Page Screenshot Generator",
        "description": "Website screenshot API to capture any webpage as an image. This screenshot API supports full page, viewport, and element screenshots. Website screenshot generator API for automated website screenshot capture, visual testing, monitoring, and thumbnail generation. Reliable page screenshot API.",
        "version": "0.0",
        "x-build-id": "2j3esykc86A2tRsvN"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/code-node-tools~website-screenshot-api/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-code-node-tools-website-screenshot-api",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/code-node-tools~website-screenshot-api/runs": {
            "post": {
                "operationId": "runs-sync-code-node-tools-website-screenshot-api",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/code-node-tools~website-screenshot-api/run-sync": {
            "post": {
                "operationId": "run-sync-code-node-tools-website-screenshot-api",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "url": {
                        "title": "URL",
                        "type": "string",
                        "description": "URL of the webpage to screenshot"
                    },
                    "urls": {
                        "title": "URLs (Batch)",
                        "type": "array",
                        "description": "Multiple URLs for batch screenshot capture",
                        "items": {
                            "type": "string"
                        }
                    },
                    "screenshotType": {
                        "title": "Screenshot Type",
                        "enum": [
                            "fullPage",
                            "viewport",
                            "element"
                        ],
                        "type": "string",
                        "description": "Type of screenshot to capture",
                        "default": "fullPage"
                    },
                    "selector": {
                        "title": "Element Selector",
                        "type": "string",
                        "description": "CSS selector for element screenshot (only used when screenshotType is 'element')"
                    },
                    "format": {
                        "title": "Image Format",
                        "enum": [
                            "png",
                            "jpeg"
                        ],
                        "type": "string",
                        "description": "Output image format",
                        "default": "png"
                    },
                    "quality": {
                        "title": "JPEG Quality",
                        "minimum": 0,
                        "maximum": 100,
                        "type": "integer",
                        "description": "JPEG quality (0-100, ignored for PNG)",
                        "default": 90
                    },
                    "width": {
                        "title": "Viewport Width",
                        "type": "integer",
                        "description": "Viewport width in pixels",
                        "default": 1920
                    },
                    "height": {
                        "title": "Viewport Height",
                        "type": "integer",
                        "description": "Viewport height in pixels",
                        "default": 1080
                    },
                    "deviceScaleFactor": {
                        "title": "Device Scale Factor",
                        "type": "number",
                        "description": "Device scale factor (1 = normal, 2 = retina)",
                        "default": 1
                    },
                    "isMobile": {
                        "title": "Mobile Emulation",
                        "type": "boolean",
                        "description": "Emulate mobile device",
                        "default": false
                    },
                    "waitForSelector": {
                        "title": "Wait for Selector",
                        "type": "string",
                        "description": "CSS selector to wait for before taking screenshot"
                    },
                    "waitForTimeout": {
                        "title": "Wait Timeout (ms)",
                        "type": "integer",
                        "description": "Additional wait time in milliseconds before screenshot",
                        "default": 0
                    },
                    "waitUntil": {
                        "title": "Wait Until",
                        "enum": [
                            "load",
                            "domcontentloaded",
                            "networkidle"
                        ],
                        "type": "string",
                        "description": "Wait until page reaches this state",
                        "default": "load"
                    },
                    "removeElements": {
                        "title": "Remove Elements",
                        "type": "array",
                        "description": "CSS selectors of elements to remove before screenshot (e.g., cookie banners)",
                        "items": {
                            "type": "string"
                        }
                    },
                    "scrollToBottom": {
                        "title": "Scroll to Bottom",
                        "type": "boolean",
                        "description": "Scroll to bottom to trigger lazy loading before screenshot",
                        "default": false
                    },
                    "darkMode": {
                        "title": "Dark Mode",
                        "type": "boolean",
                        "description": "Enable dark mode if site supports it",
                        "default": false
                    },
                    "proxyConfiguration": {
                        "title": "Proxy Configuration",
                        "type": "object",
                        "description": "Proxy settings for the browser"
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
