> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zenrows.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> The Zenrows HTTP API serves Fetch and Extract (extract=auto) at https://api.zenrows.com/v1/, Crawl at https://api.zenrows.com/v1/crawls, and Batch at https://async.api.zenrows.com/v1. Fetch, Extract, Crawl and Batch are described in OpenAPI 3.1 at https://www.zenrows.com/openapi.json and listed in the RFC 9727 API catalog at https://www.zenrows.com/.well-known/api-catalog. Every endpoint also has its own page under /api-reference with its schema. Use the spec for exact parameter names and types. Crawl's endpoints, parameters and errors are also at https://docs.zenrows.com/crawl/endpoints.md. To call Zenrows from an agent, connect the MCP server at https://mcp.zenrows.com/mcp. To search these docs from an agent, connect the docs MCP server at https://docs.zenrows.com/mcp. Agent skills for Zenrows are published at https://github.com/ZenRows/cli and install with `npx skills add ZenRows/cli`.

# Page Screenshot

> Capture a screenshot of any page (above the fold, full page, or a specific element) using the `screenshot=true` parameter.

The `screenshot=true` parameter tells Zenrows to capture a screenshot of the target page and return it as a PNG image. You get a pixel-accurate visual snapshot of the page as it appears in a browser, including styles, fonts, and JavaScript-rendered content.

This is useful for visual monitoring, page archiving, UI testing, or any workflow that needs a rendered image of a page rather than its raw content.

> [!WARNING]
>
> Screenshot parameters cannot be combined with the `outputs` parameter. Use one or the other depending on whether you need a visual capture or targeted data extraction.

## How it works

Screenshot generation always requires a full browser render. You must include `js_render=true` in every screenshot request. Zenrows renders the page in a headless browser and captures the result as an image before returning it as binary content.

By default, the screenshot captures only the above-the-fold visible area of the page. You can expand this to the full page or narrow it to a specific element using the additional parameters described below.

> [!TIP]
>
> Find more details on our [JS Rendering Documentation](https://docs.zenrows.com/fetch/features/js-rendering.md).

## Basic usage

Add `screenshot=true` and `js_render=true` to your request parameters:

```python Python theme={"theme":"css-variables"}
import requests

url = "https://www.scrapingcourse.com/ecommerce/"
apikey = "YOUR_ZENROWS_API_KEY"

params = {
    "url": url,
    "apikey": apikey,
    "js_render": "true",
    "screenshot": "true",
}

response = requests.get("https://api.zenrows.com/v1/", params=params)

with open("screenshot.png", "wb") as file:
    file.write(response.content)

print("Screenshot saved to screenshot.png")
```

```javascript Node.js theme={"theme":"css-variables"}
import axios from "axios";
import fs from "fs";

const url = "https://www.scrapingcourse.com/ecommerce/";
const apikey = "YOUR_ZENROWS_API_KEY";

const response = await axios.get("https://api.zenrows.com/v1/", {
params: {
    url,
    apikey,
    js_render: "true",
    screenshot: "true",
},
responseType: "stream",
});

const file = fs.createWriteStream("screenshot.png");
response.data.pipe(file);
```

```java Java theme={"theme":"css-variables"}
import java.io.File;
import org.apache.hc.client5.http.fluent.Request;

public class APIRequest {
    public static void main(final String... args) throws Exception {
        File file = new File("screenshot.png");
        String apiUrl = "https://api.zenrows.com/v1/?apikey=YOUR_ZENROWS_API_KEY&url=https%3A%2F%2Fwww.scrapingcourse.com%2Fecommerce%2F&js_render=true&screenshot=true";
        Request.get(apiUrl).execute().saveContent(file);
    }
}
```

```php PHP theme={"theme":"css-variables"}
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.zenrows.com/v1/?apikey=YOUR_ZENROWS_API_KEY&url=https%3A%2F%2Fwww.scrapingcourse.com%2Fecommerce%2F&js_render=true&screenshot=true");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
file_put_contents("screenshot.png", $response);
curl_close($ch);
?>
```

```go Go theme={"theme":"css-variables"}
package main

import (
    "io"
    "log"
    "net/http"
    "os"
)

func main() {
    client := &http.Client{}
    req, err := http.NewRequest("GET", "https://api.zenrows.com/v1/?apikey=YOUR_ZENROWS_API_KEY&url=https%3A%2F%2Fwww.scrapingcourse.com%2Fecommerce%2F&js_render=true&screenshot=true", nil)
    if err != nil {
        log.Fatalln(err)
    }

    resp, err := client.Do(req)
    if err != nil {
        log.Fatalln(err)
    }
    defer resp.Body.Close()

    img, _ := os.Create("screenshot.png")
    defer img.Close()

    io.Copy(img, resp.Body)
}
```

```ruby Ruby theme={"theme":"css-variables"}
require "faraday"

url = URI.parse("https://api.zenrows.com/v1/?apikey=YOUR_ZENROWS_API_KEY&url=https%3A%2F%2Fwww.scrapingcourse.com%2Fecommerce%2F&js_render=true&screenshot=true")
conn = Faraday.new()
conn.options.timeout = 180
res = conn.get(url, nil, nil)
File.open("screenshot.png", "wb") { |file| file.write(res.body) }
```

```bash cURL theme={"theme":"css-variables"}
curl "https://api.zenrows.com/v1/?apikey=YOUR_ZENROWS_API_KEY&url=https%3A%2F%2Fwww.scrapingcourse.com%2Fecommerce%2F&js_render=true&screenshot=true" > screenshot.png
```

## Screenshot options

### Capture mode

Three capture modes are available depending on how much of the page you need:

| Parameter | Description |
| - | - |
| `screenshot=true` | Captures the above-the-fold visible area only. Default behavior. |
| `screenshot_fullpage=true` | Captures the entire page by scrolling and stitching the full content. |
| `screenshot_selector=<CSS Selector>` | Captures only the element matched by the given CSS selector. |

> [!WARNING]
>
> `screenshot_fullpage` and `screenshot_selector` are mutually exclusive. Use one or the other in a single request.

### Viewport

Fetch screenshots render at a fixed browser viewport: there's no parameter to set a custom width or height. If a sticky header, cookie banner, or other overlay is cutting off the content you need, use `screenshot_selector` to capture only the element you care about, combined with `js_instructions` (`evaluate`) to remove or hide the overlay first.

> [!TIP]
>
> Find more details on [JS Instructions Documentation](https://docs.zenrows.com/fetch/features/js-instructions.md) for hiding overlays before capture.

### Image format and quality

By default, screenshots are returned as PNG. You can switch to JPEG for smaller file sizes using the following parameters:

| Parameter | Values | Description |
| - | - | - |
| `screenshot_format` | `png`, `jpeg` | Sets the output format. Defaults to `png`. |
| `screenshot_quality` | `1` to `100` | Sets the JPEG compression quality. Only applies when `screenshot_format=jpeg`. |

> [!TIP]
>
> Full-page screenshots can exceed 10MB as PNG. If you are hitting size limits, switch to `screenshot_format=jpeg` and tune `screenshot_quality` to find the right balance between file size and visual fidelity.

### Combining with other parameters

Screenshot requests are compatible with `wait`, `wait_for`, and `js_instructions`, which lets you control exactly when the capture happens. Use these when the page loads content after the initial render or requires user interaction before the target content is visible.

> [!TIP]
>
> Find more details on our [Wait Documentation](https://docs.zenrows.com/fetch/features/wait.md), [Wait For Selector Documentation](https://docs.zenrows.com/fetch/features/wait-for.md), and [JS Instructions Documentation](https://docs.zenrows.com/fetch/features/js-instructions.md).

When using `json_response=true`, the screenshot data is returned base64-encoded inside a JSON object instead of as raw binary, which makes it easier to handle in API workflows that expect structured responses.

> [!WARNING]
>
> `screenshot` is not compatible with `proxy_country`. Screenshot requests always route through a random IP, so you cannot target a specific country's proxy for the capture. You can still add `premium_proxy=true` to use Residential IPs instead of datacenter ones, but you cannot control their geolocation with `proxy_country`.

## When to use page screenshots

Screenshots are the right choice when you need a visual record of a page rather than its text or data. They work well for:

* **Visual monitoring**: detect layout changes, broken pages, or UI regressions across time.
* **Page archiving**: preserve a timestamped visual snapshot of how a page looked at a specific moment.
* **Element capture**: isolate and capture specific UI components, charts, or widgets using `screenshot_selector`.
* **QA and testing**: validate that pages render correctly across different URLs or conditions.
* **Reporting and sharing**: generate visual page previews for dashboards, reports, or stakeholder communication.

> [!NOTE]
>
> If you need to extract text or structured data from the page rather than a visual snapshot, use `response_type=markdown`, `response_type=plaintext`, or the `outputs` parameter instead.

## Best practices

**Always include `js_render=true`:** \

Screenshot generation requires a full browser render. Requests without `js_render=true` will not return a valid image.

**Use `wait` or `wait_for` for pages with delayed content:** \

If the page loads content after the initial render, use `wait` (milliseconds) or `wait_for` (CSS selector) to ensure everything is visible before the screenshot is captured.

> [!TIP]
>
> Find more details on our [Wait Documentation](https://docs.zenrows.com/fetch/features/wait.md) or [Wait For Selector Documentation](https://docs.zenrows.com/fetch/features/wait-for.md).

**Switch to JPEG for large full-page screenshots:** \

Full-page screenshots of long pages can exceed 10MB as PNG, which causes errors. Use `screenshot_format=jpeg` with `screenshot_quality` set between `60` and `85` for a good balance of clarity and file size.

**Save as binary, not text:** \

Screenshot files are binary. Always write the response body in binary mode (for example, `"wb"` mode in Python and Ruby, `Buffer` in Node.js, `FileOutputStream` in Java). Writing binary content as text will corrupt the image file.

**Credits are charged on successful responses:** \

A screenshot request is charged when the API returns a `200` status code, regardless of whether the image contains the content you expected. Because `js_render=true` is required, the JS rendering credit cost also applies. Test on a small set of URLs before running at scale.

## Troubleshooting

> [accordion] The screenshot is blank or shows a loading state
>
> The page likely loads content after the initial render. Add `wait` (in milliseconds) to give the page time to finish loading, or use `wait_for` with a CSS selector that is only present once the main content is visible.

> [accordion] The screenshot file is corrupted or cannot be opened
>
> You are likely writing the response as text instead of binary. Always use binary write mode in your language of choice (`"wb"` in Python and Ruby, `Buffer` in Node.js, `FileOutputStream` in Java) and write the raw response body. Image files are binary and writing them as text will produce a corrupt file.

> [accordion] The full-page screenshot is too large or returns an error
>
> Full-page screenshots of long pages can exceed 10MB as PNG. Switch to `screenshot_format=jpeg` and set `screenshot_quality` to a value between `60` and `85` to reduce the file size significantly while keeping the image readable.

> [accordion] screenshot\_selector is not capturing the right element
>
> Make sure the CSS selector you are passing targets a single, visible element. If the element is loaded dynamically, use `wait_for` with the same selector to ensure it is present in the DOM before the screenshot is taken. Avoid auto-generated or highly dynamic class names, as these can change between requests.

> [accordion] screenshot\_fullpage and screenshot\_selector are conflicting
>
> These two parameters are mutually exclusive. Use `screenshot_fullpage=true` when you want the entire page, and `screenshot_selector` when you want a specific element. You cannot use both in the same request.

> [accordion] proxy\_country has no effect on my screenshot request
>
> `proxy_country` is not supported for screenshot requests. Screenshots always use a random IP, regardless of the country you request. If you need Residential IPs for a screenshot, use `premium_proxy=true` on its own, without `proxy_country`.

## Pricing

Screenshot requests are included at **no additional cost** beyond the standard JS rendering rate. Because screenshot generation requires `js_render=true`, all screenshot requests are billed at the JS rendering credit rate. You only pay extra for Premium Proxy when used.

> [!TIP]
>
> You can monitor your Zenrows usage in multiple ways to stay informed about your account activity and prevent unexpected overages.
>
> **Dashboard monitoring**: View real-time usage statistics, remaining requests, success rates, and request history on your Analytics page. You can also set up usage alerts in your notification settings to receive notifications when you approach your limits.
>
> [Open Analytics](https://app.zenrows.com/overview#performance)
> [Open notification settings](https://app.zenrows.com/settings/notifications)
>
> **Programmatic monitoring**: For automated monitoring in your applications, call the `/v1/subscriptions/self/details` endpoint with your API key in the `X-API-Key` header. This returns real-time usage data that you can integrate into your monitoring systems. [Learn more about the usage endpoint](https://docs.zenrows.com/fetch/features/other.md#plan-usage).
>
> **Response header monitoring**: Track your concurrency usage through response headers included with each request:
>
> * `Concurrency-Limit`: Your maximum concurrent requests
> * `Concurrency-Remaining`: Available concurrent request slots
> * `X-Request-Cost`: Cost of the current request
> * `X-Key-Credits-Remaining`: Lowest remaining credits across your API key's [credit caps](https://docs.zenrows.com/first-steps/api-key-credit-caps.md), sent only for keys with at least one cap

## FAQ (Frequently Asked Questions)

> [accordion] Is js\_render=true required for screenshots?
>
> Yes. Screenshot generation requires a full browser render. You must include `js_render=true` in every screenshot request. Requests without it will not return a valid image.

> [accordion] Do screenshots cost more credits?
>
> Screenshot requests are billed at the JS rendering credit rate because `js_render=true` is required. The screenshot parameters themselves do not add an extra cost beyond that.

> [accordion] Can I capture a screenshot of a specific element on the page?
>
> Yes. Use `screenshot_selector=<CSS Selector>` to capture only the element matched by the selector. Note that `screenshot_selector` and `screenshot_fullpage` are mutually exclusive and cannot be used together.

> [accordion] What image formats are supported?
>
> PNG and JPEG are supported via the `screenshot_format` parameter. PNG is the default and is best for high-fidelity captures. JPEG offers smaller file sizes and is recommended for full-page screenshots or high-volume pipelines where storage and bandwidth matter.

> [accordion] Can I use screenshots with the Zenrows Browser?
>
> No, the `screenshot` parameters are features of Fetch. In Zenrows Browser (CDP/Playwright) sessions, you can capture screenshots directly using Playwright's built-in `page.screenshot()` method.

> [accordion] Can I get the screenshot as base64 instead of binary?
>
> Yes. Add `json_response=true` to your request and the screenshot will be returned base64-encoded inside a JSON object. This is useful for workflows that expect structured API responses rather than raw binary streams.

> [accordion] Can I target a specific country's proxy for a screenshot?
>
> No. `proxy_country` is not supported with `screenshot`, `screenshot_fullpage`, or `screenshot_selector`. Screenshot requests always use a random IP. You can still add `premium_proxy=true` to capture the screenshot through a Residential IP instead of a datacenter one, but you cannot choose its geolocation.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.