---
title: "Render HTML to an image"
method: POST
path: "/v1/screenshot"
---

# Render HTML to an image

`POST /v1/screenshot`

Renders an HTML payload to a PNG, JPEG, or WebP screenshot.

## Request body

- object
  - `html` string, required — The raw HTML string to render into an image.
  - `type` string — Image type: png, jpeg, or webp.
  - `fullPage` boolean — Capture the full scroll height of the page.
  - `quality` integer — Image quality from 1 to 100 for JPEG and WebP.
  - `omitBackground` boolean — Render with a transparent background for PNG output.
  - `waitUntil` string — Lifecycle event to wait for before rendering. Supported values: load, domcontentloaded, networkidle, commit.
  - `waitForSelector` string — Optional CSS selector to wait for before capturing.
  - `delayMs` integer — Optional extra render delay in milliseconds. Maximum 10000.
  - `viewport` object
    - `width` integer
    - `height` integer

## Response `200`

Successful screenshot generation.

## Other responses

- `400` — Bad Request (e.g., missing HTML).
- `401` — Unauthorized (missing API key).
- `402` — Payment Required (zero credits remaining).
- `403` — Forbidden (invalid API key).
- `500` — Server error while generating the screenshot.

---

[API](https://skmtc.dev/xeropdf/apis/zero-retention-pdf-api.md) · [All operations](https://skmtc.dev/xeropdf/apis/zero-retention-pdf-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/xeropdf/zero-retention-pdf-api/revisions/81d527a3ba1f/schema)
