Convert HTML to an Image via API

Send raw HTML, receive a pixel-perfect image. No browser needed on your end — SnapAPI renders your markup server-side using headless Chrome. Supports inline CSS, web fonts, and full HTML5. Returns PNG, JPEG, or WebP at any viewport size. Requires Starter plan or above.

Code Examples

cURL
Node.js
Python
curl -X POST "https://snapapi.tech/v1/render" \
  -H "x-api-key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"html":"<h1 style=\"font-family:sans-serif;color:#0070f3\">Hello, world!</h1>","width":800,"height":200}' \
  -o output.png
const html = `<!DOCTYPE html>
<html>
<head><style>
  body { font-family: sans-serif; background: #0f0f23; color: #fff; display:flex; align-items:center; justify-content:center; height:100vh; margin:0; }
  h1 { font-size: 3rem; }
</style></head>
<body><h1>Hello from SnapAPI</h1></body>
</html>`;

const res = await fetch("https://snapapi.tech/v1/render", {
  method: "POST",
  headers: { "x-api-key": "YOUR_KEY", "Content-Type": "application/json" },
  body: JSON.stringify({ html, width: 1200, height: 630, format: "png" })
});

require("fs").writeFileSync("card.png", Buffer.from(await res.arrayBuffer()));
import requests

html = """<!DOCTYPE html>
<html><head><style>
  body { font-family: sans-serif; padding: 40px; background: #fff; }
  h1 { color: #0070f3; }
</style></head>
<body><h1>Generated by SnapAPI</h1><p>HTML → Image in one request.</p></body></html>"""

resp = requests.post(
    "https://snapapi.tech/v1/render",
    headers={"x-api-key": "YOUR_KEY"},
    json={"html": html, "width": 1200, "height": 630, "format": "png"}
)

with open("output.png", "wb") as f:
    f.write(resp.content)
Get Your Free API Key Read the Docs

Try It Live

Capturing screenshot...

Why SnapAPI?

No Browser Setup

We run Chromium so you don't have to. No Puppeteer, no Selenium, no drivers.

PNG, JPEG, WebP

Choose your format. Set quality. Get optimized output.

Mobile Emulation

9 device presets — iPhone, Pixel, iPad, desktop. One parameter.

Full Page Capture

Scroll the entire page and stitch into one image. Automatic.

Element Selector

Capture a specific element by CSS selector instead of the whole page.

Dark Mode

Emulate prefers-color-scheme: dark to capture dark-themed pages.

Built For

How It Works

1. Sign up for a free API key — 100 screenshots/month, no credit card required.

2. Make a GET request to /v1/screenshot with your URL and API key.

3. Receive a pixel-perfect screenshot as a binary image, or JSON with metadata if meta=true.

That's it. No browser installation, no Chromium management, no headless infrastructure to maintain.