Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The quickest way to capture a URL with an API is to send an HTTPS request containing the page address and your API key, then save the binary response as an image or PDF. For example, ScreenshotOne documents a GET request to https://api.screenshotone.com/take?url=https://apple.com&access_key=<access key>. In production, you also choose the output format, viewport, wait strategy, full-page or element capture, and retry behavior.

This guide explains the common request model, shows runnable hosted-API and browser-automation examples, and covers full-page screenshots, CSS-selector captures, authentication, errors, performance, privacy, and cost. It uses only capabilities documented by the cited services; latency, reliability, and pricing should be measured for your own workload.

How a screenshot API works

A screenshot API accepts a URL (or, with some services, HTML), authenticates your request, renders the page in a browser, and returns binary image data or a PDF. Your application normally performs five steps:

  1. Create an account and obtain an access key.
  2. Send the URL over HTTPS. URL-encode query values, or use a JSON POST body when the HTML or option set is large.
  3. Set rendering options such as format, viewport, delay, full-page mode, selector, or interactions.
  4. Read the response as binary data and write it to a file or object store.
  5. Handle HTTP errors, quotas, timeouts, and retries without treating an error body as an image.

ScreenshotOne documents URL and HTML inputs, access-key authentication, PNG, JPEG, WebP, GIF, JP2, TIFF, AVIF, HEIF, PDF, HTML, and Markdown outputs, plus interactions such as click and hover. Urlbox documents a render endpoint that accepts either a fully qualified URL or an HTML payload. Always use HTTPS for the request.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose a hosted API or run Playwright/Puppeteer

Approach Best fit What you operate Trade-offs
ScreenshotNeo Production previews, reports, monitoring, batch work, and AI-agent workflows An HTTPS request (or its MCP server) Hosted dependency and plan limits; clean captures and billing verdicts reduce application-side work
Another hosted API A stable HTTP interface without browser infrastructure Credentials, quotas, retries, and response handling Compare each provider’s formats, limits, retention, rate policy, and error semantics
Playwright or Puppeteer Maximum browser and interaction control, or workloads where you already run browsers Browser binaries, scaling, isolation, patching, queues, and observability No per-request hosted API dependency, but operational maintenance becomes your responsibility

There is no universal latency, reliability, or price ranking in the documentation. Test the option you select with your pages, concurrency, geographic requirements, and retention policy.

Make your first hosted screenshot request

GET request with ScreenshotOne

Replace the placeholder key and save the binary response. The endpoint can also be called with a POST JSON body when you need a larger option set.

curl -G "https://api.screenshotone.com/take" 
  --data-urlencode "url=https://apple.com" 
  --data-urlencode "access_key=YOUR_ACCESS_KEY" 
  -o screenshot.png

Use --data-urlencode for URLs containing query strings, fragments, or non-ASCII characters. Check the HTTP status before publishing the file; a failed request may be JSON or text rather than image bytes.

What to configure

  • Input: a fully qualified URL, or HTML if the provider supports HTML input.
  • Format: choose PNG for lossless UI detail, JPEG for smaller photographic files, WebP where your consumers support it, or PDF for documents.
  • Viewport and device: set width, height, device scale, or a documented device preset so captures are reproducible.
  • Timing: use a delay, selector wait, or network-idle condition when client-side content appears after the initial navigation.
  • Full page: enable the provider’s full-page option when the image must include content below the viewport.
  • Interaction: click or hover before capture when a menu, tab, or consent control must be opened.

Full-page and element screenshots

Full-page capture with a hosted API

Urlbox documents this JSON shape for a complete page:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
{ "url": "https://urlbox.com", "full_page": true }

Its skip_scroll option avoids an initial lazy-load scroll when that behavior is unnecessary, while full_width handles pages that scroll horizontally. Full-page rendering can create a very tall image; select PDF output or split the work when downstream systems impose pixel or file-size limits.

Rank #2
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

Capture one element by CSS selector

Urlbox documents a selector capture such as:

{ "url": "https://example.com", "selector": "#element-to-screenshot" }

The selector must match an element in the rendered DOM. If it is generated dynamically, wait for that selector before taking the shot. A missing selector should be treated as a controlled failure, not as permission to silently capture the entire page.

Self-managed JavaScript with Playwright

Use this route when you need direct browser control or already operate a browser service. The official Playwright JavaScript pattern launches WebKit, navigates, writes a file, and closes the browser:

const { webkit } = require('playwright');
(async () => {
  const browser = await webkit.launch();
  const context = await browser.newContext();
  const page = await context.newPage();
  await page.goto('https://example.com');
  await page.screenshot({ path: 'screenshot.png' });
  await browser.close();
})();

For a full page, use await page.screenshot({ path: 'screenshot.png', fullPage: true });. For one element, use await page.locator('.header').screenshot({ path: 'header.png' });. Add explicit navigation and locator timeouts, close the browser in a finally block, and isolate untrusted URLs. Puppeteer’s Page.screenshot() returns a Uint8Array by default or a base64 string when its encoding option is set to base64.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Or skip the browser setup

ScreenshotNeo is a hosted screenshot API and MCP server. Before capture it accepts the cookie or consent banner like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Only clean shots are billed: bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and the response identifies the result with X-Page-Verdict and X-Billed headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.

One GET request returns PNG, JPEG, WebP, or PDF data:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo documentation for the complete parameter list. Equivalent clients are:

Python

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)

Node.js

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));

ScreenshotNeo supports 63 options, including full-page capture with lazy images loaded, CSS-selector element capture, dark mode, 12 device presets or any viewport, retina scale, PDF paper size/margins/landscape/page ranges, HTML/CSS-to-image, custom CSS and JavaScript, clicks, selector or delay/network-idle waits, ad/tracker/request/resource blocking, headers, cookies, user agent, Authorization, timezone, geolocation, transparent backgrounds, resizing, chosen-TTL caching, signed public-image links, asynchronous jobs with signed webhooks, bulk capture of 100 URLs per call, a usage API, an OpenAPI specification, and compatibility with parameter names used by other screenshot APIs. Every feature is on every plan.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Plan Included shots Price
Free 1,000 per month $0, no card
Starter 3,000 $5
Growth 15,000 $15
Pro 60,000 $39
Scale 250,000 $99
Business 1,000,000 $249

Yearly billing gives two months free. Create a free ScreenshotNeo account to get 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.

Authentication, response handling, and retries

Protect credentials

  • Keep access keys in environment variables or a secret manager, never in browser JavaScript or public repositories.
  • Restrict outbound URL inputs if users can submit arbitrary addresses; otherwise your renderer can become a server-side request-forgery target.
  • Redact keys from logs and avoid logging cookies or Authorization headers.

Validate before saving

  1. Check the HTTP status code.
  2. Inspect the documented content type or provider-specific error mode.
  3. Write bytes only after the response passes those checks.
  4. Record request ID, URL host, elapsed time, and provider error code, but not secrets.

Retry safely

Retry transient network failures and documented 5xx responses with exponential backoff and jitter. Do not blindly retry authentication failures, invalid URLs, selector-not-found errors, or quota responses. If the provider offers asynchronous jobs and webhooks, use them for long renders or large batches rather than holding a request open.

Performance, reliability, and cost decisions

  • Rendering time: wait only for the condition your page needs. A fixed long delay wastes capacity; a selector or network-idle wait is usually more deterministic.
  • Image size: WebP or JPEG can reduce storage and transfer; PNG preserves sharp text and transparent pixels.
  • Concurrency: queue work and honor provider rate limits. For many URLs, use a documented bulk endpoint or asynchronous jobs.
  • Caching: cache stable pages with a defined TTL, but invalidate when visual freshness matters. ScreenshotNeo lets you choose the cache TTL and does not bill cache hits.
  • Browser operations: self-managed systems need capacity planning, sandboxing, browser updates, and cleanup of crashed workers; hosted APIs exchange that work for request pricing and provider limits.
  • Validation: test pages with cookie banners, lazy images, authentication, responsive breakpoints, slow third-party scripts, and bot defenses before committing to a provider.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common failures

401 or 403 authentication error

Verify the key name, account status, and HTTPS endpoint. Ensure the key is sent in the documented query parameter or JSON field, and check that shell quoting did not truncate it.

400 invalid URL or malformed request

Send a fully qualified URL including the scheme. URL-encode query values, or move a large option set to POST JSON. Confirm that booleans and selector strings use the provider’s documented types.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers

Blank or incomplete page

The page may render content after navigation, require a wait condition, or depend on blocked third-party resources. Add a selector, delay, or network-idle wait; verify the viewport; and test whether request blocking removed a required asset.

Lazy images are missing

Use full-page mode that scrolls the document, or configure the provider’s lazy-load behavior. A screenshot taken at the initial viewport cannot include images that have not been requested.

Element selector fails

Check the selector in the rendered DOM, account for iframes or shadow roots, and wait for the element. If it is optional, branch explicitly to a fallback capture instead of hiding the failure.

Timeouts and oversized files

Reduce unnecessary waits, block nonessential resources, lower the viewport or scale, or produce a PDF/page range instead of one extremely tall bitmap. For repeated slow pages, use asynchronous jobs and monitor failure rates.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Bot check or CAPTCHA appears

Do not attempt to bypass access controls. Treat the result as unavailable, follow the site’s access policy, or obtain authorized credentials. ScreenshotNeo marks bot checks and CAPTCHAs as non-clean results and does not bill those responses.

Privacy and operational checklist

  • Confirm that you are authorized to capture the target content and that your handling meets its privacy and terms requirements.
  • Choose whether URLs, rendered HTML, cookies, and images may be retained by a hosted provider; document the retention setting.
  • Use separate credentials for development and production.
  • Set deterministic viewport, timezone, locale, and user-agent values when visual comparisons must be repeatable.
  • Keep the original URL and rendering options with each artifact so a later diff is explainable.
  • Alert on sudden increases in timeout, blank-page, selector, or quota errors rather than silently serving stale screenshots.

FAQ

Can an API return a PDF instead of an image?

Yes. ScreenshotOne documents PDF output, and ScreenshotNeo provides PDF capture with paper size, margins, landscape mode, and page ranges.

Should I send a URL or raw HTML?

Send a URL when you need the page as a visitor sees it. Send HTML when you generate the document yourself or need to avoid an external navigation; confirm that your selected provider supports HTML input.

How do I capture a responsive mobile view?

Set an explicit mobile viewport or device preset and, when supported, a device scale factor. Keep those values fixed across runs so visual diffs compare like with like.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What is the safest way to expose screenshots in an <img> tag?

Use a provider’s signed public-image URL feature, restrict its lifetime, and avoid putting private page data in a URL that browsers or referrers can leak.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.