> ## Documentation Index
> Fetch the complete documentation index at: https://docs.screenframed.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Batch Automation

Generate multiple screenshots from files, scripts, manifests, or CI jobs.

Batch automation is for image sets: docs refreshes, directory thumbnails, changelog images, store screenshots, and social campaigns.



## CLI batch

Create a URL file:

```txt urls.txt
https://example.com
https://example.com/pricing
https://example.com/docs
```

Run:

```bash
screenframed batch urls.txt \
  --device browser-macos \
  --background midnight \
  --format webp \
  --out-dir screenshots
```

## API manifest loop

```javascript
const jobs = [
  { name: "home", url: "https://example.com" },
  { name: "pricing", url: "https://example.com/pricing" },
  { name: "docs", url: "https://example.com/docs" },
];

for (const job of jobs) {
  const response = await fetch("https://screenframed.com/v1/capture", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.SCREENFRAMED_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      url: job.url,
      device: "browser-macos",
      background_preset: "midnight",
      shadow: "soft",
      async: true,
    }),
  });

  const queued = await response.json();
  console.log(job.name, queued.job_id);
}
```

## CI guidance

**Use manifests**

Keep capture inputs in versioned JSON so changes are reviewable.
  **Scrape links from production blindly**

Curated screenshot sets produce more stable assets than crawling arbitrary pages.

## Retry and backoff

For batch jobs:

1. Queue with `async: true`.
2. Persist each `job_id`.
3. Poll `/v1/jobs/{id}` with backoff.
4. Retry only failed jobs after inspecting the error.
5. Store the final CDN URLs in your asset manifest.

## Local watch mode

Use watch mode while developing a page:

```bash
screenframed watch http://localhost:3000 \
  --device browser-macos \
  --background arctic \
  --output preview.png \
  --interval 5
```