---
title: "HTML + CSS to PNG"
method: POST
path: "/image"
---

# HTML + CSS to PNG

`POST /image`

## Request

- Base URL: `https://fastcrawl.net/api/v1`
- URL: `https://fastcrawl.net/api/v1/image`
- Auth: HTTP bearer

Route POST /api/v1/image (server url + path). Markup in, hosted PNG out: returns the URL of the rendered PNG (Content-Type image/png). html is required and capped at 1MB, rejected locally before the upload. url is not accepted here - for a URL capture use /screenshot. 1 credit per image; an identical repeat within 30 minutes is a content-hash cache hit, returns cached:true and is free. Failed calls are never charged.

## Request body

- object
  - `html` string, required: The HTML document to render (max 1MB).
  - `css` string: Extra CSS applied to the document.
  - `viewport_width` integer: Viewport width in px (default 800).
  - `viewport_height` integer: Viewport height in px (default 600).
  - `google_fonts` string: Google Fonts to load, e.g. Inter:wght@400;700.

## Response `200`

PNG URL, plus cached:true on a free cache hit.

- object
  - `success` boolean
  - `url` string, uri: Serves content-type image/png.
  - `cached` boolean: true on an upstream cache hit - the repeat is not billed.

## Other responses

- `400`: invalid_request - html missing, html over 1MB, or url passed (use /screenshot)
- `401`: missing_api_key / invalid_api_key - body carries remediation hint + WWW-Authenticate header
- `429`: plan limit (error_code monthly_limit|daily_limit|rate_limit) or upstream render capacity reached (render_capacity_reached)
- `502`: upstream render failed (image_render_failed)

---

[API](https://skmtc.dev/fastcrawl/apis/fastcrawl-api.md) · [All operations](https://skmtc.dev/fastcrawl/apis/fastcrawl-api/llms.txt) · [OpenAPI document](https://skmtc.dev/fastcrawl/apis/fastcrawl-api/revisions/83951a14d005?raw)
