
# Web render

Point at a public web page and get back a rendered artifact — a **PDF**, a **screenshot** image, or the page's **clean article text** — from a single API call. Backed by a headless browser worker; each call is priced flat. Every URL is **SSRF-guarded**: only public `http`/`https` URLs are fetched; private, loopback, and cloud-metadata addresses are refused.

```bash
curl -X POST https://api.relaystation.ai/v1/web/pdf \
  -H 'Authorization: Bearer rs_live_<key>' \
  -H 'Idempotency-Key: web-pdf-20260707' \
  -H 'Content-Type: application/json' \
  -d '{ "url": "https://example.com/article" }'
```

Or on the lodestone path — no account, a signed x402 payment instead of an API key:

```bash
curl -X POST https://api.relaystation.ai/v1/web/pdf \
  -H 'X-Payment: <base64 EIP-3009 authorization>' \
  -H 'Idempotency-Key: web-pdf-20260707' \
  -H 'Content-Type: application/json' \
  -d '{ "url": "https://example.com/article" }'
```

## pdf — render a URL to PDF

`POST /v1/web/pdf`. The page is loaded in a headless browser and printed to PDF.

| Field | Type | Notes |
|---|---|---|
| `url` | string, required | a public `http`/`https` URL (≤ 4096 chars) |
| `viewport` | `{ width, height }` | render viewport in px (each 1–10000) |
| `fullPage` | boolean | capture the full scroll height |
| `waitMs` | integer | extra settle time before capture, 0–20000 ms |
| `pdfOptions` | object | page-format / margin controls |

Returns the rendered PDF in the uniform JSON output envelope (inline when small, a presigned URL when large — see [Passing & receiving files](/docs/receiving-outputs)).

## screenshot — capture a URL as an image

`POST /v1/web/screenshot`.

| Field | Type | Notes |
|---|---|---|
| `url` | string, required | a public `http`/`https` URL |
| `type` | enum | `png` \| `jpeg` \| `webp` |
| `viewport` | `{ width, height }` | render viewport in px |
| `fullPage` | boolean | capture the full scroll height |
| `waitMs` | integer | extra settle time, 0–20000 ms |

```bash
curl -X POST https://api.relaystation.ai/v1/web/screenshot \
  -H 'Authorization: Bearer rs_live_<key>' \
  -H 'Idempotency-Key: web-shot-20260707' \
  -H 'Content-Type: application/json' \
  -d '{ "url": "https://example.com", "type": "png", "fullPage": true }'
```

Returns the screenshot image in the uniform output envelope.

## readability — clean article text

`POST /v1/web/readability` strips the chrome, ads, and navigation and returns the article body.

```bash
curl -X POST https://api.relaystation.ai/v1/web/readability \
  -H 'Authorization: Bearer rs_live_<key>' \
  -H 'Idempotency-Key: web-read-20260707' \
  -H 'Content-Type: application/json' \
  -d '{ "url": "https://example.com/article" }'
```

Returns `{ title, byline, excerpt, textContent, length }`.

## SSRF guard — read this before you rely on it

Every URL is validated **before the fetch and again at the egress point**. Only public `http`/`https` URLs are allowed; requests to private ranges, loopback (`127.0.0.1`, `localhost`), link-local, and cloud **metadata** addresses (e.g. `169.254.169.254`) are blocked and return a `422` before any charge. By default the render fetches **same-origin only** — the page's own resources, not arbitrary cross-origin assets. This is a deliberate wall: it stops the renderer from being turned into a proxy into a private network.

## Billing

Each op is a **flat per-call charge**: `pdf` bills **per render**, `screenshot` bills **per screenshot**, `readability` bills **per extract**. A URL blocked by the SSRF guard returns a `422` and is not charged. Priced per call; see [Pricing](/pricing) for the current rates, or send an unauthenticated `POST` to read the exact price from the `402` challenge. Every billable call needs an `Idempotency-Key`; a same-key retry returns the cached result without re-charging.

## MCP tools

Callable over MCP at `https://api.relaystation.ai/mcp`: `url_to_pdf`, `url_screenshot`, and `url_readability`. Same auth, same prices as the HTTP routes.

## Next

[Passing & receiving files](/docs/receiving-outputs) · [PDF tools](https://cputools.relaystation.ai/docs/pdf-tools) · [Quickstart](/docs/quickstart) · [x402 wire format](/docs/x402) · [API reference](/api-reference)
