Why Do Screenshot APIs Take 21 Seconds? I Built One That Does It in 2

# webdev# api# node# showdev
Why Do Screenshot APIs Take 21 Seconds? I Built One That Does It in 2The AI Entrepreneur

I benchmarked screenshot APIs on RapidAPI. The fastest took 6 seconds. Most took 14-21 seconds. Some...

I benchmarked screenshot APIs on RapidAPI. The fastest took 6 seconds. Most took 14-21 seconds. Some had 74% uptime.

So I built my own. It does screenshots in 2.1 seconds and PDFs in 1.2 seconds.

The Problem

If you've ever tried to programmatically capture a webpage, you know the pain:

  • Self-hosted Puppeteer = server maintenance, memory leaks, Chrome crashes
  • Screenshot-as-a-service APIs = slow (6-21 seconds), expensive ($50-300/month), unreliable (74-94% uptime)
  • Playwright in CI = fine for tests, terrible for production APIs

I needed something fast, reliable, and cheap. So I built it on Apify's Standby infrastructure.

The Architecture

The secret to sub-3-second delivery is browser pre-warming:

  1. On startup, launch Chromium via Puppeteer and keep it running
  2. For each request, create a new page (not a new browser)
  3. Navigate, wait for network idle, capture
  4. Close the page, return the result
  5. Cache results for 10 minutes (same URL + same params = instant)

This avoids the 3-5 second cold start that kills most screenshot APIs.

Benchmarks

API Screenshot Time PDF Time Uptime
This API 2.1s 1.2s 100%
Competitor A 8.4s N/A 94%
Competitor B 14.2s N/A 90%
Competitor C 21s 15s 74%

Endpoints

Screenshot

GET /screenshot?url=https://github.com&width=1920&height=1080&format=png&fullPage=true
Enter fullscreen mode Exit fullscreen mode

Parameters: url, width (320-3840), height (200-2160), format (png/jpeg/webp), fullPage, quality (1-100), delay (ms).

PDF

GET /pdf?url=https://github.com&format=A4&landscape=false
Enter fullscreen mode Exit fullscreen mode

Parameters: url, format (A4/Letter/Legal), landscape, printBackground.

Batch (up to 20 URLs)

POST /batch
{
  "urls": ["https://google.com", "https://github.com"],
  "width": 1280,
  "format": "jpeg"
}
Enter fullscreen mode Exit fullscreen mode

Response Formats

Binary (default): Raw image/PDF bytes with Content-Type header.

Base64 JSON (set Accept: application/json):

{
  "base64": "iVBORw0KGgo...",
  "mimeType": "image/png",
  "size": 15856,
  "latencyMs": 2172
}
Enter fullscreen mode Exit fullscreen mode

Use Cases

  • Visual QA Testing — Screenshot every page after deployment, diff against baselines
  • Social Media Cards — Generate OG images for link previews
  • Competitive Monitoring — Daily screenshots of competitor pricing pages
  • PDF Reports — Convert web dashboards to downloadable PDFs
  • Web Archiving — Capture pages before they change

Pricing

  • Screenshots: $0.005 each ($5 per 1,000)
  • PDFs: $0.008 each ($8 per 1,000)
  • Only charged on success (failed captures = free)

Try It

  • Apify Store: Screenshot & PDF API
  • Also on RapidAPI: Search "Website Screenshot PDF"
  • Built with Puppeteer on Apify Standby (always-on HTTP, no queue)

The code uses apify/actor-node-puppeteer-chrome as the base image. Spec was generated using OpenSpec + Codex.

Questions? @ai_in_it on X.