Tutorial

How to Screenshot Password-Protected Pages

Capture screenshots of pages behind login forms using cookies or basic auth. Handle authenticated page captures securely.

Steps

  1. Use cookies for session authPass cookies from an authenticated session using the cookies parameter. Format: name=value; name2=value2.
  2. Basic auth alternativeFor sites using HTTP Basic Auth, include credentials in the URL: https://user:pass@site.com.
  3. Keep credentials secureStore API keys and cookies in environment variables. Never hardcode credentials in client-side code.

Code Examples

curl "https://snapapi.tech/v1/screenshot?url=https://example.com/dashboard&api_key=YOUR_KEY&cookies=session_id%3Dabc123" -o dashboard.png
import requests

response = requests.get("https://snapapi.tech/v1/screenshot", params={
    "url": "https://example.com/dashboard",
    "api_key": "YOUR_KEY",
    "cookies": "session_id=abc123; auth_token=xyz789"
})
with open("dashboard.png", "wb") as f:
    f.write(response.content)
const res = await fetch(
  "https://snapapi.tech/v1/screenshot?" + new URLSearchParams({
    url: "https://example.com/dashboard",
    api_key: "YOUR_KEY",
    cookies: "session_id=abc123; auth_token=xyz789"
  })
);
require("fs").writeFileSync("dashboard.png", Buffer.from(await res.arrayBuffer()));
Get Free API KeyFull API Docs