Screenshot API
A JPEG of any page: the visible window or the whole page.
The Screenshot API opens a page in a real browser and returns a JPEG: the visible window, or the whole page from top to bottom.
Call it
curl https://data.upscrape.com/screenshot \ -H "Authorization: Bearer $UPSCRAPE_API_KEY" \ -H "Content-Type: application/json" \ -H "Prefer: wait=30" \ -d '{"url": "https://www.wikipedia.org/", "full_page": true}'
import base64import osimport requestsjob = requests.post( "https://data.upscrape.com/screenshot", headers={"Authorization": f"Bearer {os.environ['UPSCRAPE_API_KEY']}", "Prefer": "wait=30"}, json={"url": "https://www.wikipedia.org/", "full_page": True},).json()image = job["results"][0]["data"]["image"]with open("wikipedia.jpg", "wb") as f: f.write(base64.b64decode(image["data"]))
import { writeFile } from "node:fs/promises";const res = await fetch("https://data.upscrape.com/screenshot", { method: "POST", headers: { Authorization: `Bearer ${process.env.UPSCRAPE_API_KEY}`, "Content-Type": "application/json", Prefer: "wait=30", }, body: JSON.stringify({ url: "https://www.wikipedia.org/", full_page: true }),});const job = await res.json();const image = job.results[0].data.image;await writeFile("wikipedia.jpg", Buffer.from(image.data, "base64"));
The image is in results[0].data.image: base64 in data, with its content_type and size in bytes. It travels inside the JSON, so there is no link to expire.
Set up the shot
| Input | What it does |
|---|---|
full_page | The whole page, top to bottom, instead of the visible window. |
viewport_width, viewport_height | The browser window, 1440 by 900 by default; from 320 by 200 up to 3840 by 2160. Use 390 by 844 for a phone. |
wait_for_selector | Wait until an element matching this CSS selector appears, for pages that fill in after they load. |
wait_ms | Wait this many milliseconds before the shot, up to 10 seconds. |
The image is a JPEG.
Something missing or unclear? Ask the team that builds the endpoints.