Tutorial

How to Take a Website Screenshot with an API

Learn how to capture website screenshots programmatically using a REST API. Step-by-step guide with code examples in Python, Node.js, and cURL.

Steps

  1. Get your API keySign up at snapapi.tech for a free API key. You get 100 API calls per month, no credit card required.
  2. Choose your parametersDecide on format (PNG, JPEG, WebP), viewport size, full page capture, and device emulation.
  3. Make the API callSend a GET request to /v1/screenshot with your URL and API key. The response is the screenshot image.
  4. Save the resultWrite the binary response to a file, or use meta=true to get JSON with the screenshot as base64.

Code Examples

curl "https://snapapi.tech/v1/screenshot?url=https://example.com&api_key=YOUR_KEY&format=png" -o screenshot.png
import requests

response = requests.get("https://snapapi.tech/v1/screenshot", params={
    "url": "https://example.com",
    "api_key": "YOUR_KEY"
})

with open("screenshot.png", "wb") as f:
    f.write(response.content)
const res = await fetch(
  "https://snapapi.tech/v1/screenshot?" + new URLSearchParams({
    url: "https://example.com",
    api_key: "YOUR_KEY"
  })
);
require("fs").writeFileSync("screenshot.png", Buffer.from(await res.arrayBuffer()));
Get Free API KeyFull API Docs