Screenshot API

Send an address, get a picture. The page is loaded in a real browser, and the answer is the image itself – ready to save, to show in your app or to hand to a vision model.

Start with 50 free creditsOpen playground

You send

GET /v1/screenshot
  ?url=https://shop.example/product/42
  &full_page=true
  &width=1280
  &format=webp
Endpoint
GET /v1/screenshot
Cost
10 credits per picture up to 1 MB
Plans
All plans, Free included
Failed requests
Not charged
Documentation
Step-by-step guide

A screenshot service of your own means browsers on servers, pages that load their content late or only while you scroll, and pictures that come out half empty because they were taken too early.

How VirginProxy helps

  • GET /v1/screenshot answers with the image itself – PNG, JPEG or WebP, in the size and quality you set.
  • The visible area, the whole page up to 16,000 pixels high, or just one element chosen by CSS selector.
  • Wait for an element, scroll to load more, or pause briefly for animations before the picture is taken.
  • As a desktop or a phone sees the page, in light or dark mode, in the language and time zone you choose.

How it works, step by step

  1. Name the page

    Send the address as url to GET /v1/screenshot. All options are query parameters, so a link or a single curl line is enough.

  2. Choose the section

    The visible area, the whole page with full_page=true, or one element with selector.

  3. Say when the page is ready

    wait_for waits for an element, scroll loads more content first, wait_ms gives animations time to finish.

  4. Save the picture

    The answer is the image itself. Credits, the page’s status and the request id come in X-VP-* headers.

Example request

A product page as a full-page WebP, 1,280 pixels wide.

curl -G https://api.virginproxy.com/v1/screenshot \
  -H "Authorization: Bearer $VP_KEY" \
  --data-urlencode "url=https://shop.example/product/42" \
  -d full_page=true \
  -d width=1280 \
  -d format=webp \
  -o page.webp
import os, requests

r = requests.get(
    "https://api.virginproxy.com/v1/screenshot",
    headers={"Authorization": "Bearer " + os.environ["VP_KEY"]},
    params={
        "url": "https://shop.example/product/42",
        "full_page": "true",
        "width": 1280,
        "format": "webp"
    },
    timeout=180,
)
r.raise_for_status()
open("page.webp", "wb").write(r.content)
print(r.headers["X-VP-Credits"], "credits")
import { writeFile } from "node:fs/promises";

const q = new URLSearchParams({
  "url": "https://shop.example/product/42",
  "full_page": "true",
  "width": "1280",
  "format": "webp"
});
const res = await fetch(`https://api.virginproxy.com/v1/screenshot?${q}`, {
  headers: { Authorization: `Bearer ${process.env.VP_KEY}` },
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
await writeFile("page.webp", Buffer.from(await res.arrayBuffer()));
console.log(res.headers.get("X-VP-Credits"), "credits");
$q = http_build_query([
    "url" => "https://shop.example/product/42",
    "full_page" => "true",
    "width" => "1280",
    "format" => "webp",
]);
$ch = curl_init("https://api.virginproxy.com/v1/screenshot?" . $q);
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("VP_KEY")],
    CURLOPT_TIMEOUT => 180,
]);
file_put_contents("page.webp", curl_exec($ch));
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
q := url.Values{}
q.Set("url", "https://shop.example/product/42")
q.Set("full_page", "true")
q.Set("width", "1280")
q.Set("format", "webp")
req, _ := http.NewRequest("GET", "https://api.virginproxy.com/v1/screenshot?"+q.Encode(), nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("VP_KEY"))

res, err := http.DefaultClient.Do(req)
if err != nil {
	log.Fatal(err)
}
defer res.Body.Close()
f, _ := os.Create("page.webp")
defer f.Close()
io.Copy(f, res.Body)
fmt.Println(res.Header.Get("X-VP-Credits"), "credits")

Documentation for this feature · API reference

What comes back

The answer is the picture; the figures come in headers:

HTTP/2 200
content-type: image/webp
x-vp-request-id: req_7HqN2cVb9LmX4tRw8KpE
x-vp-credits: 10
x-vp-status: 200
x-vp-final-url: https://shop.example/product/42

What it costs

A screenshot costs what any page rendered in a browser costs: 10 credits as long as everything the browser loads stays under 1 MB, 1 more per further MB. Images and fonts are loaded – a picture needs them – so image-heavy pages can cost a little more. block leaves out images, media, fonts or stylesheets, and max_credits sets an upper limit.

Pricing and cost examples

Good to know

  • For a phone picture, set browser=chrome_android or safari_ios and leave out width: the page gets the phone’s own screen size.
  • scale=2 gives a sharp picture for high-resolution screens.
  • X-VP-Status shows how the page answered. A screenshot of an error page is still a screenshot, so check it when it matters.
  • If selector matches nothing visible, you get screenshot_failed. The page was loaded, so this case is charged.

Questions

What does a screenshot cost?

10 credits as long as the browser loads up to 1 MB for the page, 1 more for each further MB. Pages that do not load in time cost nothing.

Can I get the HTML and the picture together?

Yes. Use "screenshot" inside "render" in POST /v1/requests: the answer carries the page and the picture, the picture as base64.

Which formats and sizes are possible?

PNG, JPEG or WebP; width 240 to 3,840 and height 240 to 4,320 pixels, pixel density 0.5 to 4. A full page can be up to 16,000 pixels high.

Is a failed screenshot charged?

If the page does not load in time, no. If it loads but no picture can be taken – for example because the element was not found – it is charged, because the page was loaded.

Can I keep cookies or the IP between screenshots?

Yes. With session, your screenshots use the same IP and cookies as your other requests with that name.

Try it with 50 free credits

Pick up where you left off

No card needed. Your first request takes two minutes.

Your credits, keys and recent requests are waiting in the dashboard.

Start with 50 free creditsGo to dashboard