How to Take Screenshots of Web Pages Behind a Login: A Simple Guide

Profile
Usama Shabbir

23 Mar 2025 | 6 min read

Introduction to Screenshot Capture

Taking a screenshot of a public web page can be tricky. If the page is behind a login or authentication wall, it gets even harder. That’s where Screenshot API helps. Our service securely captures and stores your authentication cookies. It then uses these cookies to log in for you. This way, you can easily generate screenshots of any protected page without manual workarounds. HD Website ScreenshotAPI | screenshotapi.net Capture HD screenshots for any website in seconds with Screenshot API. We support webp, jpeg, pdf, and more rendered on real Chrome browsers.

ScreenshotAPI.net makes things easier. Unlike other solutions, it captures and stores your authentication cookies just once. Then, it reuses them whenever you need to take a snapshot of a protected page.

So buckle up and get comfortable—we’re about to walk you through every step involved. Let’s start with the basics.

Understanding Login Profiles and Restrictions

When you want to take a snapshot of a page behind authentication, a login profile in Screenshot API focuses on your active session cookies. You don't need a username or password. By using the cookies your browser holds after signing in, we give you instant access to protected content without filling out forms or exchanging tokens.

Why Cookies?

Cookies store your logged-in state. Once you provide a valid session cookie string or upload your browser’s cookie file, our system uses those cookies for every request. This way, you avoid manual login steps completely.

For example, we’ll use youtube.com to delve more deeply into the details. Let's take screenshot without cookies template we will get:

Image
Screenshot without Cookies Template

Now let's start to remove this Login Confirmation:

1) Export Your Session Cookies

There are two ways to to export your session cookies:

To export cookies for your target site, open youtube.com , then right-click anywhere on the page and choose Inspect (or press Ctrl+Shift+I). In the DevTools panel, go to Application ➔ Storage ➔ Cookies ➔ https://www.youtube.com , and copy the cookie values you need.

Image
Export Cookies Manually

Rather than copying cookies manually from Devtools, streamline the process with a browser extension like EditThisCookie. After installing it, simply navigate to youtube.com , click the EditThisCookie icon in your toolbar, and choose “Export” to download your session cookies in one click. It’s fast, reliable, and highly recommended.

Image

Now you have the cookies that will help you to create the login profile.

2) Configure Your Profile

Now that you’ve exported your session cookies, head to your Screenshot API dashboard and navigate to Cookies Template → Create. Click Next, paste your cookie string into the provided field, and then select Add Cookies.

Image
Configure Your Profile

One important detail is the cookie format. If you exported your cookies using the EditThisCookie extension, they’ll already be in the correct structure—but if you copied them manually from DevTools, you’ll need to verify they follow the proper format before adding them to your profile.

[
	{
		"key" : "value",
		// your other cookies parameters
	},
	//other cookies if any
]

Below is an example of the correct cookie format—please review it for reference:

[
	{
		"domain": ".youtube.com",
		"expirationDate": 1779395419.241763,
		"hostOnly": false,
		"httpOnly": false,
		"name": "__Secure-1PAPISID",
		"path": "/",
		"sameSite": "unspecified",
		"secure": true,
		"session": false,
		"storeId": "0",
		"value": "8AQrwyujQZ3DaoBS/flkjdshfisdhjf",
		"id": 1
	},
	{
		"domain": ".youtube.com",
		"expirationDate": 1779395419.241946,
		"hostOnly": false,
		"httpOnly": true,
		"name": "__Secure-1PSID",
		"path": "/",
		"sameSite": "unspecified",
		"secure": true,
		"session": false,
		"storeId": "0",
		"value": "g.a000vwh-zrRWGEeIFZ-foEnvK41B6M90-2sOOzWHKpiHtzAKbqjh6IXZbhsL2ubHLbqlAbQSAQASFQHGX2Misw8Wp4NRyMou8xFxoVAUF8yK76",
		"id": 2
	}
]

Well done—your cookies are now saved, and you’ve completed the first phase. Let’s move on to the next step!

3) Reuse the cookies

Once your cookie profile is set up, the next step is actually using it to capture screenshots. Simply grab the template_id for your cookie template—just head to Dashboard → Cookies Template, locate your profile, and copy its ID.

Image
Copy the Template Id

Now you have got the template_id simply include that template_id in your screenshot API request to authenticate with your stored cookies.

Image
Add template ID in request

Now when you click on Take Screenshot button you will get the following screenshot:

Image
Youtube's Screenshot

Even after logging in, some page elements (beyond the video) may still be loading. To ensure everything appears correctly, add a 5-second delay before taking the screenshot.

Image
Adding delay while taking screenshot

After adding the initial 5-second wait, capture the screenshot again—you should now see all remaining content. If anything still hasn’t loaded, don’t worry: simply increase the delay (for example, to 10 seconds) and experiment until you find the ideal wait time for your pages. Here’s what the final result looks like:

Image
Youtube's screenshot with delay and cookies template

Taking Screenshots programmatically

For taking the screenshot programmatically you simply needs to add the template id in the request parameters. Below is an example you can go through that:

https://shot.screenshotapi.net/v3/screenshot?token={YOUR-API-TOKEN}&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdJ7dxyc-PFI&fresh=true&output=image&file_type=png&no_cookie_banners=true&wait_for_event=load&delay=5000&template_id={template-id}

You can also use our Query Builder to generate your request URL automatically: just open the Query Builder, enter your desired parameters in the UI, and it will produce the full request URL for you to copy and integrate directly into your code.

Image

Features

  • Encryption at Rest: All cookie data is encrypted in our database, keeping your session tokens safe.
  • Profile Isolation: Only your API key can access and execute your cookie profiles—no other user or service can retrieve them.
  • View/Update/Delete: you can view, update and delete any cookies template just click on the burger menu in front of the template:
Image
Update/View/Delete functionality

Looking Ahead: Cookies Expiration Notification

We’re also building a cookie-expiration notification service that will alert you before any of your session cookies lapse—ensuring your templates stay up to date and your screenshot captures continue to run seamlessly.

Conclusion and Next Steps

Capturing screenshots of pages behind a login is now simple. You can export your browser's active session cookies and create a cookie-based login profile at in Screenshot API. This process removes the need for manual form submissions or repeated token handling. After a quick setup—installing an extension like EditThisCookie, exporting your cookies, and validating your profile—you can use our /screenshot endpoint in any language or framework. This way, you can quickly access protected content. From there, you can automate snapshots in cron jobs, integrate them into your app's workflows, or scale up for enterprise use. To start, sign up for an API key. Then, check our documentation.