YepAPI
Web Scraping

Screenshot API

Screenshot API — capture any webpage as a PNG in headless Chrome. Viewport, full-page, or a single element by CSS selector, with custom window size. $0.02 per call.

Pricing, live playground and use cases: Screenshot API on YepAPI

POST/v1/scrape/screenshot
$0.02/call

The Screenshot API renders a page in headless Chrome and returns a PNG as base64. Capture the visible viewport, the full scrollable page with fullPage, or just one element — a chart, a pricing table, a tweet embed — with selector.

Usage

const res = await fetch('https://api.yepapi.com/v1/scrape/screenshot', {
  method: 'POST',
  headers: {
    'x-api-key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ url: 'https://example.com', width: 1440, height: 900 }),
});
const { data } = await res.json();
// data.image is a base64-encoded PNG
const img = Buffer.from(data.image, 'base64');
curl -X POST https://api.yepapi.com/v1/scrape/screenshot \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com", "selector": "main h1"}'
import base64, requests

res = requests.post(
    "https://api.yepapi.com/v1/scrape/screenshot",
    headers={"x-api-key": "YOUR_API_KEY"},
    json={"url": "https://example.com", "fullPage": True},
)
with open("page.png", "wb") as f:
    f.write(base64.b64decode(res.json()["data"]["image"]))

Request Body

ParameterTypeRequiredDescriptionDefault
urlstringYesFull http(s) URL of the page (max 4096 characters)—
fullPagebooleanNoCapture the entire scrollable page instead of the viewportfalse
selectorstringNoCSS selector — capture just this element. Overrides fullPage (max 500 characters)—
widthnumberNoBrowser window width in pixels, 100–40001920
heightnumberNoBrowser window height in pixels, 100–40001080

Response

{
  "ok": true,
  "data": {
    "url": "https://example.com",
    "image": "iVBORw0KGgoAAAANSUhEUgAA...(base64 PNG)",
    "width": 1440,
    "height": 900
  }
}

Response Fields

FieldTypeDescription
okbooleanWhether the request succeeded
data.urlstringThe URL you sent
data.imagestringBase64-encoded PNG
data.widthnumberBrowser window width used (your width, or 1920)
data.heightnumberBrowser window height used (your height, or 1080)
Info

width and height describe the browser window, not the image. A fullPage or selector capture can be taller or smaller — read the PNG's own dimensions if you need them. Screenshots are never cached; every call captures the page fresh.

Errors

StatusCodeWhen
400VALIDATION_ERRORurl is missing or invalid; width / height is outside 100–4000; selector is too long or invalid; or the URL is a Google page
404NOT_FOUNDThe target page returned 404 Not Found
429RATE_LIMITED_UPSTREAMToo many requests in flight — retry in a few seconds
502UPSTREAM_ERRORThe page could not be loaded or captured — retry
503UPSTREAM_TIMEOUTThe page took too long to load — retry

Failed calls are not charged.

On this page