API to Screenshot a URL

The simplest way to capture a screenshot of any URL programmatically. One API call, full JavaScript rendering, returns a CDN-hosted image URL within seconds.

Start Free — 200 screenshots/month
REST APIJS Rendering8 SDKsSub-2s Response

Screenshot a URL in One API Call

SnapAPI provides the cleanest URL-to-screenshot API available. POST a URL, get back an image. No browser setup, no Puppeteer dependencies, no infrastructure to manage.

curl -X POST https://api.snapapi.pics/v1/screenshot \
  -H "X-Api-Key: sk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com", "format": "png", "full_page": true}'

# Response:
# {
#   "url": "https://cdn.snapapi.pics/screenshots/abc123.png",
#   "format": "png",
#   "duration_ms": 1340
# }

JavaScript / Node.js

const response = await fetch("https://api.snapapi.pics/v1/screenshot", {
  method: "POST",
  headers: {
    "X-Api-Key": process.env.SNAPAPI_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    url: "https://github.com/vercel/next.js",
    format: "png",
    full_page: false,
    width: 1440,
  }),
});

const { url } = await response.json();
console.log("Screenshot:", url);

Python

import requests

resp = requests.post(
    "https://api.snapapi.pics/v1/screenshot",
    headers={"X-Api-Key": "sk_live_YOUR_KEY"},
    json={
        "url": "https://example.com",
        "format": "jpeg",
        "quality": 90,
        "full_page": True,
        "width": 1280,
    },
)

print(resp.json()["url"])

PHP

$response = (new \GuzzleHttp\Client())->post(
    "https://api.snapapi.pics/v1/screenshot",
    [
        "headers" => ["X-Api-Key" => "sk_live_YOUR_KEY"],
        "json" => [
            "url" => "https://example.com",
            "format" => "png",
            "full_page" => true,
        ],
    ]
);

$data = json_decode($response->getBody(), true);
echo $data["url"];

Go

req, _ := http.NewRequest("POST", "https://api.snapapi.pics/v1/screenshot", bytes.NewReader(payload))
req.Header.Set("X-Api-Key", os.Getenv("SNAPAPI_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
// decode JSON response...

Request Parameters Reference

The screenshot endpoint accepts: url (required, the target URL), format (png, jpeg, or webp), quality (1-100, for JPEG and WebP), width (viewport width in pixels, default 1280), height (viewport height), full_page (capture entire scrollable page), wait_for (CSS selector to wait for before capturing), delay (milliseconds to wait after page load), css (custom CSS to inject), js (custom JavaScript to execute), device (device preset name), stealth (enable stealth mode), and cookies (array of cookie objects).

Response Format

All screenshot responses return a JSON object with url (CDN URL to the captured image), format (the image format used), duration_ms (time taken to capture in milliseconds), and size (file size in bytes). The image URL is immediately accessible and hosted on a global CDN with a default 24-hour cache TTL.

Use Cases

Teams use the URL screenshot API for: OG image generation, link preview thumbnails, visual regression testing, monitoring dashboards, content archiving, e-commerce product page thumbnails, report generation, audit trails, and sharing site previews in Slack or email notifications. The API handles JavaScript-rendered pages, SPAs, authenticated sessions via cookies, and sites that require bot-resistance with stealth mode.

Get Your API Key

Sign up at snapapi.pics and get a free API key instantly. No credit card required. 200 screenshots per month on the free tier. Upgrade anytime as your usage grows.

Get Your Free API Key →

Advanced Screenshot API Options

Full-Page vs Viewport Screenshots

By default, SnapAPI captures a viewport screenshot — the visible portion of the page at the specified width and height. Setting full_page: true captures the entire scrollable height of the page, which is useful for documentation, landing pages, and content archives. For OG images and thumbnails, viewport captures are typically better since they show what users see above the fold.

Wait Conditions for Dynamic Pages

JavaScript-heavy pages often need a signal that they have finished rendering before the screenshot is captured. The wait_for parameter accepts a CSS selector — SnapAPI waits until the matching element appears in the DOM before taking the screenshot. Combine with delay (milliseconds) for pages that animate content in or load data progressively. This prevents capturing a loading state instead of the final rendered page.

// Wait for a React component to finish loading
{
  "url": "https://app.example.com/dashboard",
  "wait_for": "[data-loaded='true']",
  "delay": 500,
  "cookies": [
    {"name": "session", "value": "abc123", "domain": "app.example.com"}
  ]
}

Capturing Authenticated Pages

SnapAPI supports authenticated page capture by passing session cookies directly. Export cookies from your authenticated browser session using a browser extension, pass them in the cookies array, and SnapAPI renders the page as your logged-in user. This works for dashboards, admin panels, and any page behind a login form — as long as cookie-based auth is used.

Batch Screenshot Capture

For capturing multiple URLs at once, fire concurrent API requests rather than serial ones. All major HTTP clients support concurrent requests — use Promise.all in JavaScript, asyncio.gather in Python, goroutines in Go, or parallel Guzzle requests in PHP. SnapAPI handles concurrent requests on all paid plans with no throttling penalty, so you can capture dozens of pages simultaneously.

// JavaScript: capture 10 URLs concurrently
const urls = [
  "https://example.com/page-1",
  "https://example.com/page-2",
  // ...
];

const results = await Promise.all(
  urls.map(url =>
    fetch("https://api.snapapi.pics/v1/screenshot", {
      method: "POST",
      headers: { "X-Api-Key": process.env.SNAPAPI_KEY },
      body: JSON.stringify({ url, format: "png", full_page: true }),
    }).then(r => r.json())
  )
);

const imageUrls = results.map(r => r.url);

Custom Viewport and Retina Screenshots

Set device_scale_factor to 2 for retina-quality captures at 2x pixel density. This doubles the output image dimensions, producing sharper screenshots for high-DPI displays and print-quality use cases. Retina screenshots are useful for marketing materials, documentation, and App Store/Play Store screenshots where pixel quality matters.

Screenshot Webhooks for Long-Running Captures

Some pages take longer to render — complex SPAs, pages with many lazy-loaded images, or sites with slow APIs. Instead of holding an HTTP connection open for 10-30 seconds, use SnapAPI webhook mode: submit the capture job synchronously, receive a job ID immediately, and get notified at your webhook URL when the screenshot is ready. This pattern prevents timeouts and keeps your API server responsive even during long captures.

Error Handling Best Practices

SnapAPI returns standard HTTP status codes. 200 is success with the image URL in the response body. 400 is a bad request — check your JSON payload for missing required fields. 401 is an invalid or missing API key. 429 is a rate limit breach — implement exponential backoff and retry. 503 is a temporary service unavailability — retry after a short delay. Building proper error handling around these codes makes your screenshot integration resilient to transient failures and easy to debug when issues occur.

Start Screenshotting URLs Today

Sign up at snapapi.pics and get your API key in under a minute. The free tier covers 200 screenshots per month with no credit card. SDKs for JavaScript, Python, Go, PHP, Swift, Kotlin, and more are available on GitHub. Your first screenshot API call can be running in under five minutes.

SDK Reference and Integrations

SnapAPI provides official SDKs for eight programming languages, making integration straightforward regardless of your tech stack. All SDKs expose the same core functionality with typed request and response objects matching each language's idioms.

JavaScript and TypeScript: install snapapi-js from npm. Fully typed, supports ESM and CommonJS, works in Node.js and modern bundlers. Python: install snapapi from PyPI. Sync and async clients available for Django, Flask, FastAPI, and asyncio workflows. Go: available on GitHub with idiomatic error returns and context support for cancellation and deadlines. PHP: Composer package compatible with PHP 8.0 and above, using PSR-18 HTTP client abstraction that works with Guzzle and any PSR-18 compliant client.

MCP Server for AI Agent Workflows

Install snapapi-mcp from npm to use SnapAPI as a tool inside Claude, Cursor, GitHub Copilot, VS Code, Windsurf, and Zed. The MCP server exposes nine tools including screenshot, scrape, extract, pdf, video, analyze, and get_usage that AI agents can call directly without writing any integration code. This makes SnapAPI available as a first-class capability in any AI-powered workflow or agentic pipeline that supports the Model Context Protocol standard. As AI-assisted development becomes the norm in 2026, having a screenshot API available as an MCP tool is increasingly valuable for teams building automation pipelines.

Interactive Playground

The SnapAPI dashboard includes an interactive playground where you can test any endpoint with your API key before writing code. Try different URLs, formats, devices, and options and see the captured result immediately. When ready to integrate, copy the generated code snippet in your preferred language. This removes the trial-and-error of reading documentation and lets you validate the API behavior against your specific target URLs before committing to an integration approach.

Sign Up and Start Capturing URLs

Free tier at snapapi.pics. 200 screenshots per month. No credit card. Your first URL captured in under two minutes from sign-up.

The URL screenshot API is one of those capabilities that starts simple and grows with your needs. Begin with basic viewport captures for link previews, add full-page mode for content archiving, enable stealth for bot-resistant sites, and integrate webhooks for async batch processing — all through the same API key and endpoint. SnapAPI is designed to grow with you from prototype to production without API changes or migration work. Sign up free today at snapapi.pics.