Screenshot API — URL & HTML to PNG or JPEG

The same rendering pipeline that turns URLs and HTML into PDFs can hand you the pixels instead: POST /url-to-image captures any public page, POST /html-to-image renders your own markup — at exactly the window size you ask for, PNG or JPEG, through the same async queue, signed webhooks and Idempotency-Key as every other PDFik endpoint. On every plan, including Free.

Start for Free →Screenshot docs

Capture a URL

Submit the address, get a job_id, poll the job or wait for the HMAC-signed webhook, download the image. Private and internal addresses are blocked, and every page renders in an isolated, sandboxed Chromium context that is torn down after the job.

curl -X POST https://api.pdfik.net/url-to-image \
  -H "X-API-Key: sk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "options": {
      "format": "png",
      "full_page": true,
      "viewport": { "width": 1280, "height": 720 }
    }
  }'

# 202 Accepted
# { "job_id": "0b1f...", "status": "queued", ... }

curl -H "X-API-Key: sk_live_YOUR_KEY" \
  -o page.png https://api.pdfik.net/jobs/JOB_ID/download

Render HTML to an image

Social cards, chart snapshots, email previews: send the markup itself. The HTML is sanitized before rendering — the same protection as /html-to-pdf — and a viewport gives you an exact canvas size — the default already captures the visible area only, so a 1200×630 card comes out 1200×630.

curl -X POST https://api.pdfik.net/html-to-image \
  -H "X-API-Key: sk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "html": "<div style=\"width:1200px;height:630px;font:64px sans-serif;padding:80px\">Release day</div>",
    "options": { "format": "jpeg", "quality": 85, "viewport": { "width": 1200, "height": 630 } }
  }'

What you control

  • Format: PNG (default) or JPEG with quality 1–100.
  • Geometry: you set the window — width 320–1920, height 320–8192 CSS px (default 1024×768) — and we capture it as is, with no scaling or fitting. full_page follows the real page height instead, clipped at 8,192 px; that is a ceiling, not a target, so a 2,000 px page gives a 2,000 px image.
  • Timing: the same render options as the PDF endpoints on Pro+ — wait_for_selector, wait_until, extra delays.
  • Authenticated pages: basic / bearer credentials on /url-to-image (Pro+), attached only to same-origin requests.
  • Delivery: on Pro+ the delivery option uploads the image straight to your own bucket via a presigned PUT URL — nothing is stored on PDFik's side.

Same quotas, same guarantees

One capture consumes one render unit plus its bytes from your plan's monthly quota — no separate screenshot pricing to model. Files are available for 24 hours, then deleted. Test mode (test: true) is free of quota and returns a bundled sample image, so CI never burns renders. Rendering runs on AWS in the EU (Frankfurt). Full request and response shapes are in the screenshot reference; plan quotas are on the pricing page.

FAQ

How do I take a screenshot of a URL with an API?

POST the address to /url-to-image with your API key. You get a job_id back immediately; poll the job or receive a signed webhook, then download the PNG or JPEG. The render happens in an isolated, sandboxed Chromium — the same pipeline that produces PDFik PDFs.

Can I render raw HTML to an image instead of a URL?

Yes — /html-to-image takes raw HTML (sanitized before rendering, like /html-to-pdf) and returns a PNG or JPEG. It is the quickest way to turn an HTML template, chart or social card into an image.

What formats and sizes are supported?

PNG (default) and JPEG with a quality setting of 1-100. You choose the window the page opens in: width 320-1920 and height 320-8192 CSS pixels, 1024x768 by default. There is no scaling or fitting — we capture exactly the window you ask for, so the output size is something you decide rather than discover. Set full_page to true and the height follows the real page instead, clipped at 8,192 px; that is a ceiling, not a target, so a 2,000 px page still gives a 2,000 px image. Horizontal overflow wider than the viewport is never captured.

What does a screenshot cost?

There is no separate screenshot price: one capture consumes one render unit and its bytes from the same monthly quota as PDF generation, on every plan including Free. Test mode (test: true) is free of quota and returns a bundled sample image.

Where do screenshots run, and how long are files stored?

Rendering runs on AWS in the EU (Frankfurt). Generated files are available for download for 24 hours, then deleted. On Pro and Business plans the delivery option uploads the image straight to your own bucket via a presigned PUT URL, and PDFik stores no copy at all.

Create a free account →Read the docs

Full request and error reference: docs.pdfik.net/screenshots. Found something outdated? Tell us and we'll fix it.