Web Scraping
Screenshot
Take pixel-perfect screenshots of any webpage.
POST
$0.02/call/v1/scrape/screenshotUsage
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' }),
});
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", "fullPage": false}'Request Body
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
url | string | Yes | URL to screenshot | — |
fullPage | boolean | No | Capture entire scrollable page | false |
width | number | No | Viewport width in pixels | 1920 |
height | number | No | Viewport height in pixels | 1080 |
Response
{
"ok": true,
"data": {
"url": "https://example.com",
"image": "iVBORw0KGgoAAAANSUhEUgAA...(base64 PNG)",
"width": 1920,
"height": 1080
}
}Response Fields
| Field | Type | Description |
|---|---|---|
ok | boolean | Whether the request succeeded |
data | object | Response payload |
data.url | string | The URL that was screenshotted |
data.image | string | Base64-encoded PNG image data |
data.width | number | Width of the captured screenshot in pixels |
data.height | number | Height of the captured screenshot in pixels |
Info
The image field contains a base64-encoded PNG. Decode it to get the raw image bytes. For full-page screenshots, the height will reflect the actual page height.