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

# Quick actions

> Use scrape, screenshot, and PDF quick actions when one URL-level browser operation is enough.

Quick actions create an ephemeral browser, perform one URL-level operation, and return the result. Use them when the job is one scrape, one screenshot, or one PDF and you do not need browser session continuity.

Use a managed browser instead when the workflow needs login state, multiple steps, downloads, dialogs, recordings, Debug UI inspection, CDP, or post-step observations after each browser-code action.

## Choose the action

| Need                    | Use                                                            |
| ----------------------- | -------------------------------------------------------------- |
| Read page text or HTML  | `web.scrape()`, `web scrape`, or `POST /v1/scrape`             |
| Capture visual evidence | `web.screenshot()`, `web screenshot`, or `POST /v1/screenshot` |
| Render a printable page | `web.pdf()`, `web pdf`, or `POST /v1/pdf`                      |

All quick actions can use browser policy. SDK, CLI, and REST quick actions also support custom proxy configuration.

## SDK examples

```ts theme={null}
import { Web } from "@webcompute/sdk";

const web = new Web();

const page = await web.scrape({
  url: "https://example.com",
  format: "markdown",
  maxChars: 20_000,
  policy: { allowedDomains: ["example.com"] },
});

console.log(page.title);
console.log(page.content);
```

```ts theme={null}
const screenshot = await web.screenshot({
  url: "https://example.com",
  fullPage: true,
  format: "png",
});

console.log(screenshot.width, screenshot.height);
```

```ts theme={null}
const pdf = await web.pdf({
  url: "https://example.com/report",
  format: "Letter",
  printBackground: true,
});

console.log(pdf.pages);
```

## CLI examples

```bash theme={null}
web scrape https://example.com \
  --format markdown \
  --max-chars 20000 \
  --include-links
```

```bash theme={null}
web screenshot https://example.com \
  --full-page \
  --format png \
  --output example.png
```

```bash theme={null}
web pdf https://example.com/report \
  --format Letter \
  --output report.pdf
```

## REST examples

```bash theme={null}
curl -sS -X POST https://api.webcompute.dev/v1/scrape \
  -H "Authorization: Bearer $WEBCOMPUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com","format":"markdown","maxChars":20000}'
```

```bash theme={null}
curl -sS -X POST https://api.webcompute.dev/v1/screenshot \
  -H "Authorization: Bearer $WEBCOMPUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com","fullPage":true,"format":"png"}'
```

```bash theme={null}
curl -sS -X POST https://api.webcompute.dev/v1/pdf \
  -H "Authorization: Bearer $WEBCOMPUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/report","format":"Letter"}'
```

Screenshot and PDF REST responses return encoded document data. Store it in your application or move to a managed browser if you need a richer artifact lifecycle.

## When to switch to managed browsers

Switch when any of these are true:

* The task needs multiple page interactions.
* You need a Debug UI URL or CDP connection.
* The result depends on login state.
* You need downloads, dialogs, permissions, files, or recordings.
* An agent or application needs observations after each step.
* Cleanup and lifecycle control matter.

Reference: [SDK quick actions reference](/reference/sdk-quick-actions-reference), [REST API](/integrations/rest-api), [browser control](/runtime-concepts/browser-control), and [policy and proxy](/production/policy-and-proxy).
