# Full-page screenshots

> Capture the whole page with lazy-loaded content, cap its height, split it into slices, or capture one element.

## Capture the whole page

`full_page=true` captures everything from the top of the page to the bottom, not just the viewport:

```bash
curl -X POST "https://shotkit.net/api/take" \
  -H "X-Access-Key: YOUR_ACCESS_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com","full_page":true}' \
  --fail-with-body -o shot.jpg
```

Before capturing, the page is scrolled to the bottom in viewport-sized steps and back to the top. That triggers lazy-loaded images, infinite-scroll sections and scroll animations, which otherwise show up blank.

### Tune the scrolling

| Option | Default | Use it when |
| --- | --- | --- |
| `full_page_scroll_delay` | `400` ms | Content loads slowly after scrolling into view. |
| `full_page_scroll_by` | viewport height | Lazy loading is triggered by smaller steps. |
| `full_page_scroll` | on with `full_page` | Set `false` to skip scrolling for a faster capture of static pages. |

```bash
curl -X POST "https://shotkit.net/api/take" \
  -H "X-Access-Key: YOUR_ACCESS_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com","full_page":true,"full_page_scroll_by":500,"full_page_scroll_delay":800}' \
  --fail-with-body -o shot.jpg
```

Scrolling stops at 50,000 px, so infinite feeds can't scroll forever.

### Cap the height

Some pages are extremely long. `full_page_max_height` cuts the capture at a height in CSS pixels:

```bash
curl -X POST "https://shotkit.net/api/take" \
  -H "X-Access-Key: YOUR_ACCESS_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com","full_page":true,"full_page_max_height":6000}' \
  --fail-with-body -o shot.jpg
```

## Split into slices

Very tall images are hard to view and some tools can't open them. `full_page_slices` also cuts the capture into slices of `full_page_slice_height` (default 4000 px), each uploaded as its own file:

```bash
curl -X POST "https://shotkit.net/api/take" \
  -H "X-Access-Key: YOUR_ACCESS_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com","full_page":true,"full_page_slices":true,"full_page_slice_height":2000,"full_page_slice_overlap_height":100,"response_type":"json"}' \
  --fail-with-body -o shot.json
```

```json
{
  "screenshot_url": "https://shotkit.net/cdn/files/…/full.jpg",
  "slices": [
    { "index": 0, "offset_y": 0, "width": 1280, "height": 2000, "url": "https://shotkit.net/cdn/files/…/0.jpg" },
    { "index": 1, "offset_y": 1900, "width": 1280, "height": 2000, "url": "https://shotkit.net/cdn/files/…/1.jpg" }
  ]
}
```

`offset_y` is where the slice starts in the full image. With an overlap, consecutive slices share that many pixels so nothing is lost at the cut. Without `response_type=json`, the full image is returned and the `X-Full-Page-Slices-Url` header points to a JSON file with the same list.

## Capture one element

`selector` captures a single element, scrolled into view first:

```bash
curl -X POST "https://shotkit.net/api/take" \
  -H "X-Access-Key: YOUR_ACCESS_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com","selector":"main"}' \
  --fail-with-body -o shot.jpg
```

If the element is taller than the viewport, it's captured in full. Set `capture_beyond_viewport=false` to clip it to the viewport. If nothing matches, the viewport is captured, unless you set `error_on_selector_not_found=true`.

## Capture a rectangle

`clip_x`, `clip_y`, `clip_width` and `clip_height` capture an area of the page, in CSS pixels from the top-left of the document:

```bash
curl -X POST "https://shotkit.net/api/take" \
  -H "X-Access-Key: YOUR_ACCESS_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com","clip_x":0,"clip_y":0,"clip_width":1280,"clip_height":640}' \
  --fail-with-body -o shot.jpg
```

## Retina and smaller files

`device_scale_factor` multiplies the resolution (up to 5). `image_width` and `image_height` scale the result down afterwards, keeping the aspect ratio, so you can capture at 2× and deliver a sharp thumbnail:

```bash
curl -X POST "https://shotkit.net/api/take" \
  -H "X-Access-Key: YOUR_ACCESS_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com","full_page":true,"device_scale_factor":2,"image_width":800,"format":"avif","image_quality":60}' \
  --fail-with-body -o shot.avif
```
