# Rolling Video API

Source: https://docs.screenshotlens.com/docs/api/rolling-video
Summary: Record a public page as it scrolls, and get back an MP4 or a GIF.

```http
GET /v1/videos/rolling
```

The target `url` must be absolute and use `http` or `https`.

## Basic request

**cURL**

```bash
curl -G "https://api.screenshotlens.com/v1/videos/rolling" \
  --data-urlencode "url=https://example.com" \
  --data-urlencode "api_key=YOUR_API_KEY" \
  --data-urlencode "response_type=json"
```

**JavaScript**

```ts
const params = new URLSearchParams({
  url: "https://example.com",
  api_key: process.env.SCREENSHOTLENS_API_KEY!,
  response_type: "json",
})

const response = await fetch(
  `https://api.screenshotlens.com/v1/videos/rolling?${params}`,
)

const capture = await response.json()
```

## Parameters

| Parameter              | Type               | Default  | Limits                                                                                                                                                                      |
| ---------------------- | ------------------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `url`                  | absolute URL       | none     | Required. Must use `http` or `https`.                                                                                                                                       |
| `api_key`              | string             | none     | Required unless the request carries a dashboard session.                                                                                                                    |
| `response_type`        | `binary` or `json` | `binary` | Use `json` while integrating.                                                                                                                                               |
| `format`               | enum               | `Mp4`    | `Mp4`, `Gif`                                                                                                                                                                |
| `duration`             | integer            | `5`      | `1` to `30` seconds of recording                                                                                                                                            |
| `viewport_device`      | string             | none     | A Playwright device name, e.g. `iPhone 13` or `Pixel 5`. Emulates that device's viewport, user agent, and touch support, overriding `viewport_width` and `viewport_height`. |
| `viewport_width`       | integer            | `1280`   | `1` to `7680` pixels                                                                                                                                                        |
| `viewport_height`      | integer            | `720`    | `1` to `4320` pixels                                                                                                                                                        |
| `delay`                | integer            | `0`      | `0` to `10` seconds, waited before recording                                                                                                                                |
| `timeout`              | integer            | `30`     | `0` to `30` seconds                                                                                                                                                         |
| `start_delay`          | integer            | `0`      | `0` to `10000` milliseconds of still frames before the first scroll                                                                                                         |
| `scroll_delay`         | integer            | `500`    | `0` to `5000` milliseconds paused between scroll steps                                                                                                                      |
| `one_scroll_duration`  | integer            | `1500`   | `100` to `5000` milliseconds for a single scroll step                                                                                                                       |
| `scroll_by`            | integer            | `1000`   | `100` to `5000` pixels per scroll step                                                                                                                                      |
| `wait_until`           | enum               | `Load`   | `Load`, `DomContentLoaded`, `NetworkIdle0`, `NetworkIdle2`                                                                                                                  |
| `dark`                 | boolean            | `false`  | Emulates a dark color scheme                                                                                                                                                |
| `block_ads`            | boolean            | `true`   | Blocks common ad resources                                                                                                                                                  |
| `block_cookie_banners` | boolean            | `true`   | Blocks and dismisses common cookie banners                                                                                                                                  |
| `block_chat`           | boolean            | `false`  | Blocks common chat widgets                                                                                                                                                  |
| `locale`               | string             | `en-US`  | BCP 47 language tag (e.g. `en-US`, `fr-FR`, `de`). Sets the browser's `Accept-Language` header and `navigator.language`, controlling which language i18n sites render in.   |

## Response modes

### JSON

`response_type=json` returns the stored asset URL.

```json
{
  "video_url": "https://cdn.screenshotlens.com/captures/example.mp4",
  "credits_charged": 5
}
```

### Binary

The default `response_type=binary` redirects to the stored media URL, so pass `-L` to follow it.

```bash
curl -L -G "https://api.screenshotlens.com/v1/videos/rolling" \
  --data-urlencode "url=https://example.com" \
  --data-urlencode "api_key=YOUR_API_KEY" \
  --output capture.mp4
```

## Pricing

Rolling video costs 5 credits in both formats and at any duration. See [Credits and Billing](https://docs.screenshotlens.com/docs/dashboard/credits-billing) for when the charge lands and when it does not.
