# URL to Screenshot (`hulkscrape/url-to-screenshot`) Actor

An easy way to capture a screenshot of a full webpage

- **URL**: https://apify.com/hulkscrape/url-to-screenshot.md
- **Developed by:** [Kulwinder](https://apify.com/hulkscrape) (community)
- **Categories:** Automation, Developer tools, Other
- **Stats:** 2 total users, 2 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $12.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

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

## 📸 URL to Screenshot

> Capture full-page or viewport screenshots of any public webpage — clean, fast, and configurable.

---

### Overview

**URL to Screenshot** is an [Apify Actor](https://apify.com/actors) that takes a URL and returns a screenshot of the
page. It supports multiple image formats, device presets, dark mode, ad blocking, and cookie banner removal — so you
always get a clean, accurate capture.

Perfect for visual regression testing, web archiving, content previews, monitoring, and more.

---

### Features

- 📄 Full-page or viewport-only screenshots
- 🖼️ Output in `jpeg`, `png`, `webp`, or `pdf`
- 📱 Device presets: `mobile`, `tablet`, `desktop`, `4K`
- 🚫 Blocks ads, trackers, and cookie banners by default
- 🌙 Dark mode support
- 🎨 Transparent background option
- 🔒 Proxy support for anti-bot protection

---

### Input

The actor accepts a JSON input object. Only `url` is required.

#### Example Input

```json
{
    "url": "https://example.com",
    "fullPage": true,
    "fileType": "png",
    "viewportDevice": "desktop",
    "blockAds": true,
    "blockTrackers": true,
    "blockCookiesBanner": true,
    "darkMode": false,
    "quality": 90
}
````

***

#### Input Parameters

| Parameter            | Type      | Default                      | Required | Description                                                                          |
|----------------------|-----------|------------------------------|----------|--------------------------------------------------------------------------------------|
| `url`                | `string`  | —                            | ✅ Yes    | The URL of the page to screenshot. Must start with `http://` or `https://`.          |
| `fullPage`           | `boolean` | `true`                       | No       | When `true`, captures the full scrollable page instead of just the visible viewport. |
| `fileType`           | `string`  | `"jpeg"`                     | No       | Output image format. One of: `jpeg`, `png`, `webp`, `pdf`.                           |
| `blockAds`           | `boolean` | `true`                       | No       | Removes ad banners and sponsored content before capturing.                           |
| `blockTrackers`      | `boolean` | `true`                       | No       | Disables analytics scripts and tracking pixels for faster, more private captures.    |
| `blockCookiesBanner` | `boolean` | `true`                       | No       | Hides or removes GDPR/CCPA cookie consent banners for a cleaner output.              |
| `viewportDevice`     | `string`  | `"desktop"`                  | No       | Simulates a device screen size. One of: `mobile`, `tablet`, `desktop`, `4K`.         |
| `viewportWidth`      | `integer` | `0`                          | No       | Custom viewport width in pixels (0–7680). **Overrides `viewportDevice` if set.**     |
| `viewportHeight`     | `integer` | `0`                          | No       | Custom viewport height in pixels (0–7680). **Overrides `viewportDevice` if set.**    |
| `omitBackground`     | `boolean` | `false`                      | No       | Renders the screenshot with a transparent background. Only effective with `png`.     |
| `darkMode`           | `boolean` | `false`                      | No       | Requests the site's CSS dark theme via `prefers-color-scheme: dark`.                 |
| `quality`            | `integer` | `100`                        | No       | Image quality from `1` to `100`. Not applicable to `png`.                            |
| `proxyConfiguration` | `object`  | `{ "useApifyProxy": false }` | No       | Proxy settings for bypassing anti-bot protection.                                    |

***

#### Parameter Details

##### `url`

The full URL of the page to capture. Must match the pattern:

```
https://example.com
http://sub.domain.co/path/to/page
```

##### `fileType`

Choose the output format based on your use case:

| Format | Best For                               |
|--------|----------------------------------------|
| `jpeg` | General use, smaller file size         |
| `png`  | High quality, transparency support     |
| `webp` | Modern compression, smaller than jpeg  |
| `pdf`  | Document archiving, print-ready output |

##### `viewportDevice` vs `viewportWidth` / `viewportHeight`

Use `viewportDevice` to quickly simulate a known device. If you need exact dimensions, set `viewportWidth` and/or
`viewportHeight` — **these will override `viewportDevice`**.

| Device    | Approximate Width |
|-----------|-------------------|
| `mobile`  | ~375px            |
| `tablet`  | ~768px            |
| `desktop` | ~1280px           |
| `4K`      | ~3840px           |

##### `quality`

Controls compression for `jpeg` and `webp` outputs. Has **no effect on `png`**, which is always lossless.

##### `proxyConfiguration`

Pass Apify Proxy settings to route requests through a proxy. Example:

```json
{
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
}
```

***

### Output

The actor saves the screenshot to the Apify **Key-Value Store** under the key `OUTPUT`. You can retrieve it via the
Apify API or the Actor run detail page.

Example API URL to fetch the output:

```
https://api.apify.com/v2/key-value-stores/{storeId}/records/OUTPUT
```

***

### Usage Examples

#### Minimal — just a URL

```json
{
    "url": "https://news.ycombinator.com"
}
```

#### Full-page PNG with clean rendering

```json
{
    "url": "https://example.com",
    "fullPage": true,
    "fileType": "png",
    "blockAds": true,
    "blockCookiesBanner": true
}
```

#### Mobile viewport screenshot

```json
{
    "url": "https://example.com",
    "viewportDevice": "mobile",
    "fileType": "jpeg",
    "quality": 80
}
```

#### Dark mode, custom resolution

```json
{
    "url": "https://example.com",
    "darkMode": true,
    "viewportWidth": 1920,
    "viewportHeight": 1080,
    "fileType": "png"
}
```

***

### Limits & Notes

- `viewportWidth` and `viewportHeight` accept values between `0` and `7680`.
- `quality` must be between `1` and `100`; values outside this range will be rejected.
- The `omitBackground` option only produces visible transparency in `png` output.
- Cookie banner removal targets common GDPR/CCPA overlays; some custom implementations may not be detected.

# Actor input Schema

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

This is the URL of the page for which you want to take a screenshot.

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

When true, takes a screenshot of the full scrollable page, instead of the currently visible viewport.

## `fileType` (type: `string`):

Specify screenshot type, "png"|"jpeg"|"webp"|"pdf"

## `blockAds` (type: `boolean`):

Automatically identifies and removes ad banners and sponsored content from the page before capturing the screenshot.

## `blockTrackers` (type: `boolean`):

Disables analytic scripts and tracking pixels to ensure the page loads faster and remains private.

## `blockCookiesBanner` (type: `boolean`):

Automatically hides or removes GDPR/CCPA cookie consent banners and overlays for a cleaner visual output.

## `viewportDevice` (type: `string`):

Select a predefined screen size to simulate how the website appears on specific hardware categories.

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

If the viewportDevice option is set, the parameter overrides it!

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

If the viewportDevice option is set, the parameter overrides it!

## `omitBackground` (type: `boolean`):

Hides default white background and allows capturing screenshots with transparency. Not applicable to `jpeg` images.

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

Requests the website to render using its CSS dark theme via the 'prefers-color-scheme' media feature.

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

The quality of the image, between 1-100. Not applicable to png images.

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

Proxy settings for anti-bot protection

## Actor input object example

```json
{
  "url": "https://example.com",
  "fullPage": true,
  "fileType": "jpeg",
  "blockAds": true,
  "blockTrackers": true,
  "blockCookiesBanner": true,
  "viewportDevice": "desktop",
  "viewportWidth": 1920,
  "viewportHeight": 1080,
  "omitBackground": false,
  "darkMode": false,
  "quality": 100,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

No description

## `files` (type: `string`):

No description

## `images` (type: `string`):

No description

## `pdfFiles` (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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("hulkscrape/url-to-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 = {}

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

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "URL to Screenshot",
        "description": "An easy way to capture a screenshot of a full webpage",
        "version": "0.0",
        "x-build-id": "0XTNiF00C02qye5vM"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/hulkscrape~url-to-screenshot/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-hulkscrape-url-to-screenshot",
                "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/hulkscrape~url-to-screenshot/runs": {
            "post": {
                "operationId": "runs-sync-hulkscrape-url-to-screenshot",
                "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/hulkscrape~url-to-screenshot/run-sync": {
            "post": {
                "operationId": "run-sync-hulkscrape-url-to-screenshot",
                "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",
                "required": [
                    "url"
                ],
                "properties": {
                    "url": {
                        "title": "A website URL.",
                        "pattern": "^https?://(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}(?:/\\S*)?$",
                        "type": "string",
                        "description": "This is the URL of the page for which you want to take a screenshot.",
                        "default": "https://example.com"
                    },
                    "fullPage": {
                        "title": "Full Page Screenshot",
                        "type": "boolean",
                        "description": "When true, takes a screenshot of the full scrollable page, instead of the currently visible viewport.",
                        "default": true
                    },
                    "fileType": {
                        "title": "Image Format",
                        "enum": [
                            "png",
                            "jpeg",
                            "webp",
                            "pdf"
                        ],
                        "type": "string",
                        "description": "Specify screenshot type, \"png\"|\"jpeg\"|\"webp\"|\"pdf\"",
                        "default": "jpeg"
                    },
                    "blockAds": {
                        "title": "Block Advertisements",
                        "type": "boolean",
                        "description": "Automatically identifies and removes ad banners and sponsored content from the page before capturing the screenshot.",
                        "default": true
                    },
                    "blockTrackers": {
                        "title": "Block Trackers",
                        "type": "boolean",
                        "description": "Disables analytic scripts and tracking pixels to ensure the page loads faster and remains private.",
                        "default": true
                    },
                    "blockCookiesBanner": {
                        "title": "Render clean screenshots",
                        "type": "boolean",
                        "description": "Automatically hides or removes GDPR/CCPA cookie consent banners and overlays for a cleaner visual output.",
                        "default": true
                    },
                    "viewportDevice": {
                        "title": "Device Preset",
                        "enum": [
                            "mobile",
                            "tablet",
                            "desktop",
                            "4K"
                        ],
                        "type": "string",
                        "description": "Select a predefined screen size to simulate how the website appears on specific hardware categories.",
                        "default": "desktop"
                    },
                    "viewportWidth": {
                        "title": "The width of the browser viewport (pixels).",
                        "minimum": 0,
                        "maximum": 7680,
                        "type": "integer",
                        "description": "If the viewportDevice option is set, the parameter overrides it!",
                        "default": 0
                    },
                    "viewportHeight": {
                        "title": "The height of the browser viewport (pixels).",
                        "minimum": 0,
                        "maximum": 7680,
                        "type": "integer",
                        "description": "If the viewportDevice option is set, the parameter overrides it!",
                        "default": 0
                    },
                    "omitBackground": {
                        "title": "Render a transparent background for the image.",
                        "type": "boolean",
                        "description": "Hides default white background and allows capturing screenshots with transparency. Not applicable to `jpeg` images.",
                        "default": false
                    },
                    "darkMode": {
                        "title": "Enable Dark Mode",
                        "type": "boolean",
                        "description": "Requests the website to render using its CSS dark theme via the 'prefers-color-scheme' media feature.",
                        "default": false
                    },
                    "quality": {
                        "title": "Image quality",
                        "minimum": 1,
                        "maximum": 100,
                        "type": "integer",
                        "description": "The quality of the image, between 1-100. Not applicable to png images.",
                        "default": 100
                    },
                    "proxyConfiguration": {
                        "title": "Proxy Configuration",
                        "type": "object",
                        "description": "Proxy settings for anti-bot protection",
                        "properties": {
                            "useApifyProxy": {
                                "title": "Use Apify Proxy",
                                "description": "Enable or disable Apify Proxy for requests.",
                                "type": "boolean"
                            }
                        },
                        "default": {
                            "useApifyProxy": false
                        }
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
