---
title: "Render a URL as a screenshot."
method: POST
path: "/api/ai/screenshot"
tags: ["ai"]
---

# Render a URL as a screenshot.

`POST /api/ai/screenshot`

## Request

- Base URL: `https://2s.io`
- URL: `https://2s.io/api/ai/screenshot`
- Auth: API key in header `PAYMENT-SIGNATURE`

Render a URL as a screenshot. POST { url, width?, height?, fullPage?, format?, quality?, waitUntil?, timeoutMs?, deviceScaleFactor?, blockAds? }. Returns raw image bytes (no JSON envelope) with X-2s-Render-Ms and X-2s-Image-Bytes headers. Viewport clamped 320-3840 × 320-2160. Timeout clamped 1-15s. Defaults: 1280×720 PNG, networkidle2 wait, ad-blocking on. Use cases: visual verification, archival, change detection, OG-card generation, RSS thumbnails. Billing: payment settles before this endpoint runs (paid upstream), so an error after settlement IS charged — the error response then carries the payment receipt (PAYMENT-RESPONSE) and `X-2s-Charged: true`.

## Query parameters

- `trial` 1

## Request body

- object
  - `url` string, uri, required: HTTPS URL to render.
  - `width` integer: Viewport width (320-3840). Default 1280.
  - `height` integer: Viewport height (320-2160). Default 720.
  - `fullPage` boolean: Capture the full scrollable page instead of the viewport.
  - `format` 'png' | 'jpeg' | 'webp': Image format. Default png.
  - `quality` integer: JPEG/WebP quality 1-100. Ignored for PNG.
  - `waitUntil` 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2': Wait condition before snap. Default networkidle2.
  - `timeoutMs` integer: Render timeout in milliseconds (1000-15000). Default 8000.
  - `deviceScaleFactor` integer: Pixel density multiplier 1-3. Default 1.
  - `blockAds` boolean: Block ads + trackers. Default true.

## Response `200`

Raw image bytes (PNG / JPEG / WebP per `format`). X-2s-Render-Ms + X-2s-Image-Bytes response headers describe the render. No JSON envelope on success.

## Other responses

- `400`: Invalid request. Parameter validation (BAD_REQUEST / INVALID_PARAM with error.details.issues, MALFORMED_JSON) runs before payment and is never charged; a request-specific 400 raised by the endpoint itself runs after settlement on this paid-upstream operation and IS charged (`X-2s-Charged: true` + PAYMENT-RESPONSE receipt).
- `402`: Payment required. Body is the x402 PaymentRequirements envelope with a multi-network accepts array; the per-call price is in accepts[].amount (and on the operation as x-2s-price). Sign for whichever rail you hold USDC on (EIP-3009 for Base, partial SPL transfer for Solana) and retry with the PAYMENT-SIGNATURE header (X-PAYMENT also accepted for v1 clients). Also PAYMENT_SETTLE_FAILED (error envelope) when a verified payment failed to settle: error.details.chargeStatus is "not_charged" (retry with a fresh payment) or "unknown" (the authorization may still settle before its deadline — check it before retrying).
- `429`: Too many requests — RATE_LIMITED: our per-IP / per-payer limiter. Not charged; retry after Retry-After.
- `5XX`: Server-side failure. 500 INTERNAL: unexpected error; quote error.errorId (also the X-2s-Error-Id header). 502 UPSTREAM_UNAVAILABLE (or another UPSTREAM_* code): the data provider failed — composite endpoints refuse unbilled when every source fails. 503 SERVICE_PAUSED: endpoint paused by the operator kill switch, retry after Retry-After; 503 SPEND_CAP: daily upstream budget exhausted. 504 UPSTREAM_TIMEOUT. On a paid-upstream operation (see its description) this can follow settlement: then the call WAS charged and the response carries `X-2s-Charged: true` plus the PAYMENT-RESPONSE receipt. SERVICE_PAUSED and SPEND_CAP are never charged.

---

[API](https://skmtc.dev/2s-io/apis/2s-the-most-everything-api.md) · [All operations](https://skmtc.dev/2s-io/apis/2s-the-most-everything-api/llms.txt) · [OpenAPI document](https://skmtc.dev/2s-io/apis/2s-the-most-everything-api/revisions/da4c5caf686e?raw)
