DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk5 min

How to Send Custom Headers and Cookies to the Browserless Screenshot API

Browserless client-request headers are separate from target-page headers. Use /function to configure Puppeteer before navigation when a site requires custom headers or cookies.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Headers on your HTTP request to Browserless are not automatically sent to the website being captured. The current /screenshot API documentation shows no target-page header or cookie fields. For site-specific headers or cookies, use Browserless /function to configure Puppeteer’s browser page before navigation, then take the screenshot.

First, distinguish Browserless headers from target-page headers

A screenshot request involves two separate HTTP exchanges:

As an Amazon Associate I earn from qualifying purchases.

  • Your client to Browserless: headers such as Content-Type: application/json describe your API request. The Browserless token authenticates that request.
  • The browser to the target site: headers and cookies needed by the site must be configured in the browser context before it navigates to the target URL.

The current Browserless Screenshot API documentation describes URL or HTML input, screenshot options, style and script injection, and wait/navigation configuration. It does not document a request-body headers or cookies field for forwarding custom values to the target page. Adding headers to your client’s POST request therefore does not establish that the target site receives them. See the Screenshot API and shared Request Configuration documentation.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

Use /screenshot for a straightforward capture

If the page does not require custom target-site headers or cookies, send a POST request to your Browserless regional production /screenshot endpoint. Put the Browserless API token in the documented token query parameter, send JSON, and save the binary image response.

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

Replace YOUR_API_TOKEN with a securely stored token. The example’s Content-Type header applies to the JSON sent to Browserless; it is not a target-page header. Check the HTTP status and response content type before treating the response as an image. Do not commit tokens or other secrets to source control. The endpoint and request shape are documented in the Browserless Screenshot API reference.

Use /function to configure headers or cookies for the page

When the target site needs browser-level setup, use Browserless’s /function endpoint to execute custom Puppeteer code. The Function API supplies a Puppeteer page object; configure the page before page.goto(...), then capture and return the screenshot. The exact Puppeteer method signatures and cookie fields depend on the Puppeteer version supported by your deployed Browserless environment, so check that version before adapting or deploying a snippet. Browserless documents the custom-code capability, but does not publish a dedicated header-and-cookie recipe in the cited pages.

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
  1. Call the regional Browserless /function endpoint and authenticate with your Browserless token, following its Function API documentation.
  2. In the function, configure the page’s request headers and browser cookies using the API supported by that environment’s Puppeteer version.
  3. Navigate to the target URL only after configuration is complete.
  4. Wait for the page state your capture needs, take the screenshot, and return the image through the Function API response flow.

Scope cookies to the correct target domain and path, and keep their values secret. Browser-managed cookie properties such as HttpOnly cannot be reproduced by setting document.cookie in page JavaScript. Use browser-context cookie setup when those properties or other cookie attributes matter; do not treat page JavaScript as a universal substitute.

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.

Choose an endpoint based on the workflow

Need Approach Important detail
One capture with no custom target-page state /screenshot Use the documented URL and screenshot options. The client request’s headers are for Browserless, not a documented way to set target headers.
Custom browser setup before navigating /function Run Puppeteer code with the supplied page object; verify API details against the deployed Puppeteer version.
Cookies or page state must carry across independent calls Use session-capable Browserless BaaS or persisted BrowserQL state Browserless REST calls are stateless; state is discarded after the response. See the REST overview.
Target blocks automation Consider the separate /unblock API for supported cases Custom cookies do not guarantee access or a successful capture. See the Unblock API.

Handle login state and dynamic pages carefully

Login state across calls

Do not assume a later REST request inherits cookies or other browser state from an earlier response. Browserless describes REST APIs as stateless and points to BaaS sessions or persisted BrowserQL state for workflows that need persistence. Choose a session-capable route when a task requires multiple steps or repeated captures under the same login.

Wait for the content you need

For dynamic pages, use the Screenshot API’s documented wait controls or selector/event conditions. For long pages with lazy-loaded content, its FAQ recommends scrollPage: true; combine that with options.fullPage: true when you need the full-page capture. See the Screenshot API documentation.

Troubleshoot common failures

  • Browserless returns an authorization error: check that the Browserless token is present and valid, and that it is sent using an authentication method documented for the endpoint. Do not substitute a target-site cookie or authorization value for the Browserless token. The Screenshot API documents ?token=; the Function and shared REST documentation also describe authorization-header authentication.
  • The target site does not receive a custom header: confirm that you configured the browser page before navigation. A header on your client’s request to Browserless is not evidence that the target navigation received it.
  • The image is blank or shows a CAPTCHA, access denied, or 403: automation blocking may be the cause. A custom cookie alone does not guarantee success; consider /unblock only for cases its documentation supports.
  • Expected content is missing from a dynamic capture: wait for a relevant selector or event before capturing. For lazy-loaded long pages, use the documented scrolling option and full-page capture as appropriate.
  • The API call succeeds but the target page failed: inspect X-Response-Code, which shared Request Configuration documents for the target response status.
  • A legacy example does not match current behavior: the older BaaS v1 screenshot documentation is marked deprecated and no longer actively supported. Prefer the current REST API documentation for cloud usage.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

For a one-call screenshot without writing Puppeteer setup, try ScreenshotNeo. Its API accepts a URL and can return PNG, JPEG, WebP, or PDF; it also supports custom headers and cookies. 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. The Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.

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

See the ScreenshotNeo API documentation for request options. Sign up for 1,000 free screenshots a month, with no card required.

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

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.