DEV Community

Mack
Mack

Posted on • Originally published at rendly-api.fly.dev

How to Capture Website Screenshots with a Free API (Python, Node.js, Ruby)

Need to capture website screenshots programmatically? Whether you're building link previews, monitoring dashboards, or automating reports — here's how.

The Problem with DIY Screenshots

Running your own headless browser sounds appealing until you deal with:

  • Spinning up Puppeteer/Playwright instances
  • Memory leaks from zombie Chrome processes
  • Handling timeouts and dynamic content
  • Scaling for concurrent requests
  • Keeping Chromium updated and patched

A screenshot API handles all of this. Send a request, get an image.

curl

curl -X POST https://rendly-api.fly.dev/api/v1/screenshots \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://github.com",
    "format": "png",
    "width": 1280,
    "height": 720
  }' \
  --output screenshot.png
Enter fullscreen mode Exit fullscreen mode

Python

import requests

response = requests.post(
    "https://rendly-api.fly.dev/api/v1/screenshots",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
        "url": "https://github.com",
        "format": "png",
        "width": 1280,
        "height": 720
    }
)

with open("screenshot.png", "wb") as f:
    f.write(response.content)
Enter fullscreen mode Exit fullscreen mode

Node.js

const response = await fetch("https://rendly-api.fly.dev/api/v1/screenshots", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    url: "https://github.com",
    format: "png",
    width: 1280,
    height: 720
  })
});

const buffer = await response.arrayBuffer();
fs.writeFileSync("screenshot.png", Buffer.from(buffer));
Enter fullscreen mode Exit fullscreen mode

Ruby

require "rendly"

client = Rendly::Client.new(api_key: "YOUR_API_KEY")
screenshot = client.screenshot(
  url: "https://github.com",
  format: "png",
  width: 1280,
  height: 720
)

File.write("screenshot.png", screenshot)
Enter fullscreen mode Exit fullscreen mode

Customization Options

Parameter Description
width / height Viewport dimensions
format PNG, JPEG, or WebP
full_page Capture entire scrollable page
wait_for Wait ms for dynamic content
device_scale_factor 2x for retina screenshots

Common Use Cases

  • Link previews — thumbnail cards in chat apps
  • Visual monitoring — periodic regression testing
  • Report generation — render HTML as images
  • Social sharing — dynamic OG images
  • Competitive analysis — track site changes
  • Archiving — compliance snapshots

Free Tier

100 screenshots/month. No credit card. Same features as paid plans.

Paid plans start at $9/month for 1,000 renders.


Rendly — Screenshot & image generation API. Built with Rails 8 + Playwright. Try the interactive playground to test it live.

Top comments (0)