ScreenshotNeo

BlogComparisons

Best Screenshot API for Capturing Password-Protected Staging Websites

Compare screenshot APIs for staging sites behind Basic Auth, headers, or cookies, and learn when browser automation is a better fit.

By the ScreenshotNeo team4 October 20269 min read

There is no evidence-backed universal winner. The best screenshot API for a password-protected staging website is one whose current documentation explicitly supports the site’s authentication method. For HTTP Basic Auth, choose an API with a documented Basic Auth option. For token or session access, verify support for forwarding authorization headers or injecting cookies. If access requires submitting a login form, handling multi-factor authentication, or navigating after sign-in, consider browser automation such as Playwright.

A successful HTTP response does not prove the screenshot contains the authenticated page. Check the final page status and inspect the image for a login screen, access-denied message, or error page. Keep both staging credentials and screenshot API keys out of public URLs, shared links, and build logs.

1. Start with how the staging site authenticates

“Password-protected” can describe different gates. Identify which one the staging site uses before comparing providers.

Access method What the capture needs What to verify
HTTP Basic Auth The browser request must send Basic Auth credentials. The provider explicitly documents Basic Auth for target pages. Confirm how credentials are passed and whether redirects or subdomains affect them.
Token or authorization header A header such as Authorization must reach the target host. Custom target-host headers are supported, and the header is sent only where intended.
Session cookie A valid cookie must be sent for the right domain and path. Cookie injection is supported and cookie scope, expiry, and redirects match the staging flow.
Interactive sign-in The browser must submit a form, possibly handle MFA, then navigate. A single capture request may not be enough. Evaluate a browser automation workflow and the site’s permitted automation policy.

These methods are not interchangeable. A username and password for Basic Auth are not necessarily valid application login credentials, and a session cookie cannot generally be replaced by an authorization header.

2. Shortlist by documented capability

  1. ScreenshotNeo — a website screenshot API and MCP server. Its API accepts a URL in one GET request and supports custom headers and cookies. It is a practical first option when those mechanisms fit the staging gate; verify the precise behavior with a controlled staging capture. It provides clean shots by accepting consent banners and removing known consent platforms, newsletter popups, and chat widgets before capture; only clean shots are billed. Plans include 1,000 free shots each month with no card, and paid plans start at $5 for 3,000. See the ScreenshotNeo site and API documentation.
  2. Screenshot API — its documentation describes a GET request returning image bytes, with cookies, repeatable headers, and Basic Auth. It also describes final page status reporting, including 401 and 403 outcomes. The documentation warns that a query-string API key can be visible in page source or server logs. Confirm current API behavior and key handling in its documentation before adoption. Official documentation.
  3. Capture — its documentation explicitly describes HTTP Basic Authentication for protected content and gives password-protected staging as a use case. Check the current documentation for the exact request format and relevant plan limits. Official documentation.
  4. Cloudflare Browser Run — documentation covers screenshot capture with HTTP Basic Authentication, custom extra HTTP headers, and cookie-based access. Confirm current request behavior and account requirements. Official documentation.
  5. Playwright — browser automation rather than a managed screenshot API. It supports page and full-page screenshots, screenshot buffers, and visual screenshot assertions. Consider it when capture depends on interactive login steps or repeatable browser control. Screenshots and visual comparisons.

The provider documentation establishes features, not universal compatibility with every SSO setup, MFA requirement, bot check, network allowlist, or application-specific login. It also does not establish a comparative winner for latency, reliability, price, retention, or credential handling. Check those points directly before procurement.

3. Choose the right capture path

When credentials alone unlock the page

Use a hosted API that explicitly supports the mechanism in use: Basic Auth, target-host headers, or cookies. Send a test request with a non-production account or short-lived credential. Inspect both status metadata and the returned image before wiring it into a CI job.

When the browser must log in

If the flow needs a form submission, a post-login redirect, MFA, or additional interaction, a browser automation script is often the more suitable design. Playwright can control navigation and take screenshots after the page reaches the expected state. Keep credentials in the execution environment’s secret store, avoid printing them, and make the capture fail if the authenticated page was not reached.

Decision checklist

  • Identify the actual gate: Basic Auth, header token, session cookie, or interactive sign-in.
  • Confirm the provider’s current documentation names that mechanism.
  • Check whether credentials are sent to the intended host across redirects and subdomains.
  • Choose the required image format, viewport, and full-page behavior.
  • Inspect final status and verify the image depicts the protected content.
  • Review key and credential handling, logs, retained captures, quotas, regions, pricing, and contract terms.
  • Use a controlled account and representative staging page for the initial evaluation.

4. DIY with Playwright for a login flow

This runnable Node.js example logs into a form-based staging site, checks that the expected authenticated page loaded, and writes a full-page screenshot. Replace the selectors and success URL with those for your application. Store the credentials in environment variables rather than source control.

import { chromium } from 'playwright';

const { STAGING_URL, STAGING_USER, STAGING_PASSWORD } = process.env;
if (!STAGING_URL || !STAGING_USER || !STAGING_PASSWORD) {
  throw new Error('Set STAGING_URL, STAGING_USER, and STAGING_PASSWORD');
}

const browser = await chromium.launch();
const page = await browser.newPage({ viewport: { width: 1440, height: 1000 } });
try {
  await page.goto(STAGING_URL, { waitUntil: 'domcontentloaded', timeout: 30_000 });
  await page.getByLabel('Email').fill(STAGING_USER);
  await page.getByLabel('Password').fill(STAGING_PASSWORD);
  await page.getByRole('button', { name: 'Sign in' }).click();

  // Replace this with a stable success condition for your application.
  await page.waitForURL('**/dashboard', { timeout: 30_000 });
  await page.getByRole('heading', { name: 'Dashboard' }).waitFor();
  await page.screenshot({ path: 'staging.png', fullPage: true });
} finally {
  await browser.close();
}

Install Playwright and its browser in the project using the current official installation instructions. For sites protected by HTTP Basic Auth, Playwright’s browser context can be configured with HTTP credentials; consult the current API documentation for the relevant browser setup. Do not treat a page load as success without asserting an application-specific element or URL.

For a provider with documented Basic Auth, use that provider’s documented request schema rather than assuming a generic parameter name or credential placement. The reviewed documentation confirms support for Basic Auth for the named services above, but it does not establish an identical request syntax across them.

5. Or skip the browser setup

For a staging site accessible with a custom header or cookie, ScreenshotNeo can capture the URL in one GET request. Its API supports custom headers and cookies; use the current documentation for exact parameter names and secret handling. The example below shows a URL capture request as documented. Read the API docs.

curl -G "https://api.screenshotneo.com/v1/shot" \
  -d access_key=YOUR_API_KEY \
  --data-urlencode url=https://stripe.com \
  -o shot.webp
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)
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 request failed: ${res.status}`);
await Bun.write('shot.webp', res);

Replace the example target URL with your staging URL and consult the docs for the supported header or cookie configuration. The code above demonstrates URL capture; it does not claim that every staging login flow works with a single request. Cookie banners, popups, and chat widgets are removed before the shot; bot checks, blank pages, and failed loads are never billed. An MCP server lets AI agents take screenshots. 1,000 screenshots a month are free with no card, and paid plans start at $5 for 3,000. Sign up for free.

6. Validate the capture before relying on it

  1. Check the page outcome. Use final status or provider verdict metadata when available. A 401 or 403 means the intended protected content was not retrieved.
  2. Inspect the pixels. Confirm the screenshot shows the expected authenticated page, not a login form, denial page, or blank state.
  3. Exercise redirects. Test the exact staging hostname and redirect destinations. A credential or cookie scoped to one host may not work after a redirect.
  4. Test expiry and repeatability. Session cookies expire; tokens may rotate. Run the capture with the same renewal process the production workflow will use.
  5. Keep failure visible. In CI, fail the job or flag the artifact when the expected page assertion is absent. Do not silently publish a login-page screenshot as a successful capture.

7. Security, performance, reliability, and cost

Credential security

  • Use a dedicated, least-privilege staging account and short-lived credentials where practical.
  • Keep API keys, passwords, authorization headers, and cookies in secret storage. Avoid source control, shared links, and public build logs.
  • Review whether credentials are sent only to the target host and how the provider handles request logs and retained captures.
  • Some APIs use query-string API keys; query parameters may appear in logs or page source. Prefer a documented safer credential mechanism when available.
  • Check credential behavior through redirects and across subdomains. Do not assume a cookie’s domain and path match the destination.

Performance and reliability

There is no verified cross-provider benchmark here. Capture time depends on the site, authentication flow, page readiness condition, asset loading, and whether the screenshot is full-page. A hosted API reduces browser infrastructure you operate; Playwright gives you control over interactive steps but means you must manage the browser runtime and login flow. Set bounded navigation and wait timeouts, wait for a meaningful page condition instead of an arbitrary long delay, and make retries safe for the site.

Cost and procurement

Compare current quotas and pricing for your expected capture volume, then account for retries and failed authentication. The reviewed sources do not establish a market-wide price or reliability winner. ScreenshotNeo’s stated plans are 1,000 shots/month free with no card; Starter $5 for 3,000; Growth $15 for 15,000; Pro $39 for 60,000; Scale $99 for 250,000; Business $249 for 1,000,000. Yearly billing gives two months free, and every feature is on every plan. Its billing rule is that only clean shots are billed; responses say which outcome occurred through X-Page-Verdict and X-Billed headers. Verify current plan details and API behavior in the documentation.

8. Troubleshooting

Symptom Likely cause What to do
Screenshot shows a login page Credentials were not sent, the auth method was mismatched, or the login flow needs interaction. Confirm whether the gate is Basic Auth, a token, a cookie, or form login. Check the provider’s documented support and use browser automation for interactive sign-in.
401 Unauthorized Missing, expired, malformed, or invalid credentials. Check the credential type and value, cookie expiry, and whether the request reaches the intended host.
403 Forbidden The account lacks permission or access is blocked by policy, allowlisting, or another gate. Check staging permissions, IP/network restrictions, bot protections, and provider compatibility. Do not count the image as a successful capture.
Works at the initial URL but fails after redirect The destination host or path has different credential or cookie scope. Inspect the redirect chain and verify which host receives each credential.
Blank or incomplete screenshot Capture occurred before the page reached its useful state, or the page failed to load. Wait for a stable selector or application success condition; inspect status and console/network errors where available.
Playwright times out waiting for a URL or selector The login was rejected, MFA is pending, or the success condition does not match the application. Check the resulting page and use a stable, application-specific URL or element. Handle any required MFA according to the site’s policy.
Credential appears in logs Secrets were placed in a URL, command output, or debug logging. Rotate exposed credentials, remove them from logs where possible, and use secret storage plus a documented safer API-key mechanism.

9. FAQ

How do I take a screenshot of a password-protected staging site?

Identify its auth method, use a documented API feature for that method, then verify the final page status and screenshot. If login requires browser interaction, automate that flow with a browser tool such as Playwright.

Can a screenshot API pass Basic Auth or session cookies?

Some providers document Basic Auth, cookies, or custom headers. Confirm the current request syntax and test against your staging site; support for one method does not imply support for another or compatibility with every SSO setup.

Should I use an API or Playwright?

Use a hosted API when credentials alone unlock the page and the provider supports that auth method. Use Playwright when the browser must perform login steps or you need browser-level assertions and control.

Is an image response enough to prove authentication worked?

No. Check the final status or verdict and inspect the image for the expected authenticated content.

Sources and scope

This is a documentation-led feature comparison, not hands-on testing, a pricing survey, or a reliability benchmark. Provider features and terms can change. Confirm current pricing, quotas, retention, logging, deployment geography, and the precise login behavior you need before relying on a service. Sources: Screenshot API documentation; Capture documentation; Cloudflare Browser Run documentation; Playwright screenshots; Playwright screenshot assertions.