Cut a full-page screenshot into slices
Get a long page as a set of images, top to bottom, with fullPageSlices and sliceHeight, for viewers, vision models and tools that cannot take one tall image.
Updated
A full-page screenshot of a long page is one very tall image. Many viewers, vision models and document tools handle it badly. This guide shows how to get the same page as a set of smaller images with fullPageSlices.
Ask for slices
curl -X POST https://api.wayfern.com/api/v1/screenshot \
-H "Authorization: Bearer $WAYFERN_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/docs/long-page",
"width": 1280,
"height": 800,
"capture": {
"fullPage": true,
"fullPageSlices": true,
"sliceHeight": 1600,
"format": "jpeg",
"quality": 85
}
}' The response has the usual full-page image in data.screenshot and the slices in data.slices:
{
"success": true,
"data": {
"screenshot": { "url": "https://...", "key": "screenshots/USER_ID/...jpg", "contentType": "image/jpeg", "bytes": 912004 },
"slices": [
{ "url": "https://...", "key": "screenshots/USER_ID/...jpg", "contentType": "image/jpeg", "bytes": 201377 },
{ "url": "https://...", "key": "screenshots/USER_ID/...jpg", "contentType": "image/jpeg", "bytes": 188950 }
],
"metadata": { "title": "Long page", "statusCode": 200 }
},
"credits": 5
} Each slice has the same fields as the main image: url, urlExpiresAt, key, contentType, bytes and expiresAt. The example leaves some out for space.
The price does not change. A capture with slices costs 5 credits, the same as one image.
How the page is cut
- Slices are in order from the top of the page to the bottom.
- Every slice is the viewport width and
sliceHeightCSS pixels tall. The last slice is shorter when the page height is not a multiple ofsliceHeight. - The slices cover the whole page with no gap and no overlap.
- The page is measured after the same preparation as the main image: cookie banners, ads,
hideSelectors,click,scripts, the lazy-load scroll andsettleMs. - A page taller than 20,000 px is cut at 20,000 px, the same height as the main image.
Slices use the image format and quality of the main image.
Choose a slice height
sliceHeight is from 400 to 10,000 CSS pixels. When you leave it out, one slice is one viewport: the height of the request, or 844 with mobile: true and 900 otherwise. A viewport lower than 400 px gives slices of 400 px.
The 400 px minimum limits one capture to 50 slices on the tallest page.
Rules
| Combination | Result |
|---|---|
fullPageSlices with fullPage: false | 400, slices need a full page |
fullPageSlices with selector | 400, an element capture has no slices |
sliceHeight without fullPageSlices | 400 |
fullPageSlices on a scrape | 400, slices are a Screenshot API option |
Without fullPageSlices, the response has no slices field, as before.
Keep the slices
The url of each slice is a signed link with a short life. The objects are kept for 7 days. To download a slice after its link expired, send its key to POST /api/v1/artifacts/link:
curl -X POST https://api.wayfern.com/api/v1/artifacts/link \
-H "Authorization: Bearer $WAYFERN_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "key": "screenshots/USER_ID/0b7e5d31-2a4c-4f96-8e1d-7c3b9a6f2e08.jpg" }' The call is free. It returns key, a new url and its urlExpiresAt.
Slices for agents
The MCP tool capture_screenshot takes full_page_slices and slice_height. A vision model can then read a long page one slice at a time. See the agents guide.
Every field is in the Screenshot API reference and the limits are on the limits page.