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

To screenshot a URL with an API, send the target address and capture options to a screenshot service, then save the returned image bytes or use the image URL it returns. Three practical routes are a hosted REST endpoint that returns an image, a hosted API that returns a CDN URL or redirect, and a browser automation query interface for more control.

The right choice depends on how your code should receive the result, whether you need sessions or multi-step interaction, and which capture controls are required. The examples below follow the providers’ documented request patterns; they have not been independently tested. Use current provider documentation for account requirements and endpoint details.

1. Use a hosted REST endpoint that returns image bytes

For a basic capture, the shortest workflow is an authenticated HTTP request with the page URL and options in JSON. Browserless’s current screenshot documentation shows a POST request to its production endpoint, with the token in the query string and the image returned as the response body.

cURL example

curl -X POST 'https://production-sfo.browserless.io/screenshot?token=YOUR_API_TOKEN' 
  -H 'Cache-Control: no-cache' 
  -H 'Content-Type: application/json' 
  -d '{"url":"https://example.com/","options":{"fullPage":true,"type":"png"}}' 
  --output screenshot.png

Replace YOUR_API_TOKEN with a credential from your Browserless account. The documented example writes the response directly to screenshot.png. The request body supplies the page URL and capture options; this example requests a full-page PNG. Treat the token as a secret: do not commit it to a public repository or expose it in client-side code.

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

What to set before expanding the request

  • Viewport or full page: a normal viewport capture shows the visible browser area; full-page mode asks the service to capture beyond it.
  • Output type: choose a supported image format, and verify how the endpoint handles the response before changing the filename extension.
  • Readiness: dynamic pages may need a navigation wait, a delay, or a selector wait so the target content is present before capture.
  • Lazy content: images and sections loaded only during scrolling may not appear unless the page is scrolled before the capture.

Browserless documents configurable navigation and wait behavior, as well as scrolling as a way to give lazy-loaded content a chance to render. Exact option names and placement should be checked in its current Screenshot API documentation.

2. Use an API that returns an image URL or redirect

Some APIs do not make the image itself the only response you handle. Screenshot API documents a bearer-authenticated POST request and a workflow in which the result may be a CDN URL or a redirect to image bytes. Its getting-started example describes a JSON result containing screenshotUrl; confirm the response behavior for the endpoint and request mode you use.

cURL example

curl -X POST 'https://api.screenshot-api.org/api/v1/screenshot' 
  -H 'Authorization: Bearer YOUR_API_KEY' 
  -H 'Content-Type: application/json' 
  -d '{"url":"https://example.com","format":"png","fullPage":true}'

Substitute your account’s API key. If the response is JSON, parse its image URL and fetch that URL when you need a local file. If the request redirects to image bytes, handle the redirect and save the binary response instead. Do not assume a JSON response solely from the request shape; use the provider’s current API documentation to confirm the actual response for your endpoint.

Options and endpoint differences

The provider’s documentation describes PNG, JPEG, WebP, and PDF output, viewport dimensions, full-page capture, selectors, waits, custom CSS and JavaScript, and batch requests. Some advanced settings are POST-only, so do not assume the same parameters work across every HTTP method. For a selected page element, use a supported selector option; for a specific rectangular region, use a clipping option if that endpoint exposes one. Check whether each control is available on the endpoint and method you call.

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

The docs also describe a batch endpoint. That may fit a workflow that captures multiple URLs, but the endpoint’s request limits and response structure need to be taken from its current reference rather than inferred from a single-page example.

3. Use a browser automation query interface for more control

If you need to express navigation and capture as steps in a browser automation environment, Browserless documents BrowserQL as another route. Unlike the one-action REST screenshot call, this query first navigates and then requests a screenshot. Its example requests base64 image data:

mutation Screenshot {
  goto(url: "https://example.com") { status }
  screenshot(fullPage: true, type: png) { base64 }
}

This is a documented syntax pattern, not an independently tested request. The returned base64 data must be decoded before saving it as a PNG file. BrowserQL documentation lists additional screenshot controls, including full-page capture, clipping, selector capture, output type, quality, image waiting, and timeout. Choose this route when your existing integration uses Browserless’s browser/query environment or when its documented controls better fit the capture; a simple REST screenshot call is more direct when you only need one image and do not need a multi-step flow.

Choose the response workflow and controls you need

The three approaches differ in how you authenticate, consume output, and express browser work. These are documented behaviors, not a universal ranking: compare the current endpoints against the pages and workload you actually need to capture.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Approach Authentication and response Documented strengths Important consideration
ScreenshotNeo GET request with an access key; returns a clean PNG, JPEG, WebP, or PDF capture. Consent-banner handling and removal of known popups/widgets; capture options; response headers report the page verdict and billing status. Use the product documentation for exact parameters and integration details.
Browserless REST screenshot POST request with a token in the endpoint query string; documented example saves raw PNG bytes. Screenshot options, waits, and page-capture controls documented for the REST endpoint. Browserless describes its REST APIs as stateless, single-action calls without session persistence.
Screenshot API POST request with a bearer API key; documented result workflow may use a CDN URL or redirect. Formats, viewport, full-page capture, selectors, waits, custom CSS/JavaScript, and a batch endpoint are documented. Some advanced options are POST-only; confirm the response shape for the endpoint used.
Browserless BrowserQL Browserless query interface; the documented screenshot mutation can return base64 data. Navigation and screenshot in a multi-step query, with controls including clipping and selector capture. It is a different integration style from the single-action REST screenshot request.

For any provider, determine whether the response is binary, JSON with an image URL, a redirect, or base64 before writing the save logic. A file extension alone does not convert image data: save the actual returned format or decode/convert it deliberately.

How to handle dynamic pages and incomplete captures

Wait for the content that matters

A page can finish its initial navigation before a client-side app has populated the section you want. Prefer a documented wait for a meaningful selector when one is available; use a delay only when there is no reliable page-state signal. Browserless documents configurable waits and navigation options. Screenshot API also documents wait behavior.

Give lazy-loaded content a chance to appear

Full-page capture does not necessarily force every lazy image or below-the-fold component to load. Browserless recommends scrolling before capture so lazy content has an opportunity to render. If the API offers an interaction or script option, use the provider’s documented mechanism and verify that it runs before the screenshot step.

Capture just one element

Use a CSS selector where the service supports selector capture. A selector is usually more resilient than hard-coded coordinates when layout changes, but it must uniquely identify the intended element and exist by the time capture starts. If selector capture is unavailable, a clipping rectangle may work; coordinate units and option placement are provider-specific.

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

Or skip the browser setup: ScreenshotNeo

ScreenshotNeo is a website screenshot API and MCP server by Yorker Media. Make one GET request with the target URL; it returns a PNG, JPEG, WebP, or PDF. The documented options include full-page capture with lazy images loaded, CSS-selector capture, viewport/device presets, dark mode, waits, custom CSS and JavaScript, and PDF settings. See the ScreenshotNeo API documentation for the full parameter reference.

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

Cookie banners are accepted like a visitor and more than 60 known consent platforms, newsletter popups, and chat widgets are removed before capture; each of those steps can be turned off. Bot checks/CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and each response says which outcome occurred through X-Page-Verdict and X-Billed headers. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients. The free plan includes 1,000 shots a month without a card; paid plans start at $5 for 3,000 shots.

Sign up free for ScreenshotNeo to get 1,000 screenshots a month with no card.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Common errors and practical fixes

  • The saved file is JSON or unreadable: the endpoint may have returned an error body, JSON containing an image URL, or a redirect rather than binary image data. Inspect the HTTP status, content type, and response body; then follow the provider’s documented response workflow.
  • The image is blank or missing the target content: the page may still be rendering when capture starts. Add an appropriate documented wait condition, such as a selector wait or navigation setting, and make sure the selector matches the rendered page.
  • Images or sections below the fold are absent: lazy loading may not have been triggered. Use the provider’s documented scrolling or page interaction capability before capture.
  • A selector capture fails: check selector syntax, ensure the element exists on the rendered page, and wait for it before capture. If the service uses clipping instead, confirm its expected coordinate system and option location.
  • You see a CAPTCHA, 403, or access-denied screen: the target site may be blocking automated traffic. Browserless cautions that advanced fingerprinting and interactive challenges can still block REST calls. A screenshot service cannot guarantee access to every site; use authorized access methods and do not treat a challenge page as a successful capture.
  • Authentication fails: verify that the token or bearer key belongs to the provider and is placed in the documented location. Keep credentials out of logs and public code.

Reliability, performance, and cost decisions

Rendered screenshots depend on both the screenshot service and the target site’s behavior. Slow scripts, consent dialogs, bot controls, or changing page structure can affect the output. For production workflows, inspect status codes and response metadata, set a client timeout appropriate to your page workload, and decide how your application handles retryable failures versus blocked or invalid targets. Avoid retry loops that repeatedly submit a request that is consistently challenged by the target.

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

Providers differ in session behavior and result handling. Browserless characterizes its REST APIs as stateless single-action calls without session persistence; if a task requires login state or several interactions, assess a documented mode that supports that workflow rather than assuming a REST screenshot endpoint retains a browser session. Screenshot API documents batching, while the reviewed Browserless REST screenshot page does not establish equivalent batch support.

No comparable prices, quotas, latency measurements, or success rates are established by the cited provider documentation here. Check each provider’s current account terms and test against your own target pages and capture requirements before estimating ongoing cost or reliability. ScreenshotNeo’s stated plan prices and included monthly volumes are described in its block above.

Frequently Asked Questions

Can an API screenshot a URL without opening a browser on my computer?

Yes. A hosted screenshot service renders the page remotely and returns image data or a result URL; the examples above send HTTP requests rather than launching a local browser.

Can I capture only part of a webpage through an API?

Often, using a CSS selector or clipping rectangle when the specific provider endpoint supports it. Selector and clip options are provider-specific, so check the endpoint reference before relying on them.

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

Will a screenshot API always get past a site’s CAPTCHA?

No. Bot defenses and interactive challenges can block automated capture, and a returned image may show a challenge or access-denied page instead of the intended content.

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.