URL to Image API

Convert any URL to a high-quality PNG or JPEG image in milliseconds. Full-page captures, device emulation, custom viewports, and ad blocking — over a single HTTP endpoint.

Start Free — 200 captures/month

Convert a URL to an Image in One API Call

SnapAPI renders any URL in a real Chromium browser and returns either a hosted image URL or raw binary data. JavaScript executes fully, CSS animations settle, lazy-loaded images appear — the capture reflects what a real user sees, not a bare HTTP response.


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

The response JSON contains a screenshot_url field with a time-limited link to the rendered image, plus metadata including the page title, final URL after redirects, and render duration in milliseconds.

For applications that need the raw image bytes rather than a URL — for example, storing directly to S3 or serving from your own CDN — set "response_type": "binary" and the API returns the image as a base64-encoded string in the JSON response body.

Common URL to Image Use Cases

Open graph image generation is one of the most popular applications of URL-to-image APIs. When a user creates a new post, project, or profile page in your application, automatically capture a screenshot and use it as the social preview image. This makes shared links appear rich and branded on Twitter, LinkedIn, Slack, and iMessage.

Thumbnail generation for content management systems follows the same pattern. Blog platforms, link aggregators, and read-later apps all benefit from showing a visual preview of linked pages rather than a blank placeholder or a generic icon.

Visual regression testing integrates URL-to-image APIs into CI/CD pipelines. Capture a screenshot on each pull request, compare it pixel-by-pixel against a baseline, and fail the build if the visual diff exceeds a threshold. This catches layout regressions that unit tests miss entirely.

Competitive monitoring, website archiving, compliance screenshot capture, email preview rendering, and dynamic PDF cover page generation are other production use cases teams run on SnapAPI today.

Device Emulation and Viewport Control

Capture the same URL as it appears on any device using the device parameter. SnapAPI ships over 30 device presets — iPhone 15, Samsung Galaxy S23, iPad Pro, MacBook Pro Retina — each configured with the correct viewport, pixel density, and user agent string.

For custom resolutions, set width and height directly. Use device_scale_factor to simulate a high-DPI retina display at any viewport size. The full_page flag extends the capture vertically to include all content below the fold, regardless of how long the page is.

Combine viewport control with clip coordinates to capture a specific region of a page rather than the entire viewport — useful for extracting chart screenshots or product card images from larger pages without post-processing.

Handling JavaScript-Rendered Pages

Single-page applications built with React, Vue, Angular, and Next.js render their content client-side after JavaScript executes. A naive screenshot of these pages captures only the loading state — a blank white area or a spinner. SnapAPI waits for the page to reach a stable state before capturing, using the browser's network idle detection to determine when all critical resources have loaded.

For pages with animations or deferred content, use the delay parameter to add a fixed wait in milliseconds after the page reaches network idle. A 500–1500ms delay covers most CSS animation completion and intersection-observer-triggered lazy loading. The wait_for_selector parameter is more precise: the capture fires only after a specific CSS selector appears in the DOM, ensuring your target content is present regardless of loading time variability.

Cookie consent banners and GDPR overlays frequently obscure page content in screenshots. Set hide_cookie_banners: true to automatically dismiss these before capture. For more complex interstitials, the custom_js parameter lets you run arbitrary JavaScript in the page context before the screenshot fires — useful for closing popups that resist standard detection.

Custom CSS injection via the custom_css parameter hides or resizes page elements before capture. Common applications include hiding sticky headers that overlap content in full-page captures, removing promotional banners, and forcing fixed-position elements to scroll with the page.

URL to Image in Python and JavaScript

The API is language-agnostic — any HTTP client works. Here is a minimal Python example using requests:

import requests

resp = requests.post(
    "https://api.snapapi.pics/v1/screenshot",
    headers={"X-Api-Key": "YOUR_API_KEY"},
    json={"url": "https://example.com", "full_page": True, "format": "png"}
)
print(resp.json()["screenshot_url"])

And the equivalent in JavaScript with fetch:

const res = await fetch("https://api.snapapi.pics/v1/screenshot", {
  method: "POST",
  headers: { "X-Api-Key": "YOUR_API_KEY", "Content-Type": "application/json" },
  body: JSON.stringify({ url: "https://example.com", full_page: true })
});
const { screenshot_url } = await res.json();
console.log(screenshot_url);

SnapAPI also provides official SDKs for JavaScript, Python, Go, PHP, Swift, Kotlin, Java, and C# available at github.com/Sleywill. The JavaScript SDK supports both Node.js and browser environments and is published as snapapi-js on npm.

Image Formats, Storage, and CDN Delivery

SnapAPI returns screenshots as PNG, JPEG, or WebP. PNG provides lossless quality — best for visual regression testing where pixel-perfect accuracy matters. JPEG with configurable quality (default 85) produces smaller files suitable for thumbnails and previews. WebP offers the best compression-to-quality ratio for web delivery and is supported by all modern browsers.

By default, the API hosts screenshots for 72 hours and returns a CDN-backed URL. For permanent storage, retrieve the base64 image data using "response_type": "binary" and write it to your own S3 bucket, Google Cloud Storage, or Cloudflare R2. This keeps your application in full control of image lifecycle and avoids any dependency on SnapAPI's hosting for long-term access.

Free tier: 200 URL-to-image captures per month, no credit card required. Starter at $19/month supports 5,000 captures. Pro at $79/month provides 50,000. Sign up at snapapi.pics and make your first capture in under five minutes.

URL to Image API Comparison

Several services offer URL-to-image conversion: ScreenshotOne, Urlbox, Apiflash, and Screenshotlayer are the most well-known. SnapAPI differentiates by combining screenshots with scraping, content extraction, PDF generation, video recording, and AI page analysis in a single API. Rather than subscribing to separate services for each capability, a single SnapAPI key covers all of them.

Pricing is competitive: the free tier at 200 captures per month requires no credit card and includes full access to all endpoints. Starter at $19/month provides 5,000 captures, Pro at $79/month gives 50,000, and Business at $299/month delivers 500,000. All plans include stealth mode, ad blocking, and cookie banner dismissal at no extra cost.

Batch URL to Image Processing

For workflows that convert hundreds or thousands of URLs to images — generating thumbnails for a link directory, archiving a list of competitor pages, or producing visual reports across a portfolio of sites — send concurrent API calls using your language's async primitives. Python's asyncio with aiohttp, Node.js Promise.all, and Go goroutines all work well. Respect the rate limit headers returned with each response and throttle when X-RateLimit-Remaining approaches zero.

Webhook Delivery for Long Captures

Some pages take several seconds to render fully — complex dashboards with heavy JavaScript, pages behind geographic load balancers, or sites with slow third-party scripts. Rather than holding your HTTP connection open, pass a webhook_url parameter. SnapAPI will POST the capture result to your webhook endpoint when rendering completes, freeing your client from blocking on the response.

The webhook payload includes the screenshot URL, page metadata (title, final URL after redirects, status code), render duration, and any errors encountered. Verify the webhook origin using the signature header to prevent spoofing.

MCP Server: URL to Image from Your AI Editor

The SnapAPI MCP server (snapapi-mcp on npm, version 3.2.0) connects directly to Claude Code, Claude Desktop, Cursor, VS Code, Windsurf, and Zed. Once installed, your AI coding assistant can capture screenshots from natural language prompts — "take a screenshot of example.com at mobile viewport" triggers the API call and returns the image URL in your chat context.

Nine tools are exposed through the MCP server: ping, screenshot, scrape, extract, pdf, video, analyze, get_usage, and list_devices. Authentication uses the SNAPAPI_API_KEY environment variable with the X-Api-Key header format. Install with a single command: npx snapapi-mcp.

For developers building automated visual testing pipelines, the MCP server enables AI-driven screenshot comparison workflows directly in the development environment — capture a baseline, make code changes, capture again, and let your AI assistant analyze the visual differences without switching to a separate tool.

SnapAPI URL to image conversion supports PNG JPEG and WebP output formats with configurable quality settings and device scale factor for retina high density pixel ratio displays across desktop tablet and mobile viewport sizes.