Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk5 min

How to Convert a Password-Protected Webpage to PDF with PDFShift

Send PDFShift a Basic Auth object or an existing session cookie, authenticate the API request with X-API-Key, and save the response as a PDF.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To convert a protected page with PDFShift, send a POST request to https://api.pdfshift.io/v3/convert/pdf, include your PDFShift API key in the X-API-Key header, and provide the source page’s authentication separately: an auth object for HTTP Basic Auth, or a cookies array for an existing authenticated session. Save the successful response as a PDF. These methods cover the documented authentication patterns; they do not mean PDFShift will automatically complete any website’s login form.

Choose the authentication method the page actually uses

There are two separate authentication layers in this request. Your PDFShift API key authenticates you to PDFShift. The auth credentials or session cookies authorize the conversion service to retrieve the protected source page.

As an Amazon Associate I earn from qualifying purchases.

Page access method What you provide Where it goes
HTTP Basic Authentication challenge Username and password auth object in the JSON request body
Already-authenticated session Valid cookie name and value cookies array in the JSON request body

Both methods still require the X-API-Key header. Do not put the PDFShift API key in the page’s auth object or treat the page password as your API key.

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

Convert a page protected by HTTP Basic Auth

Use this method when the web server responds to the page request with an HTTP Basic Authentication challenge. PDFShift’s documented request sends the source URL and an auth object in JSON.

#1 Best Overall
PDF Extra 2024| Complete PDF Reader and Editor | Create, Edit, Convert, Combine, Comment, Fill & Sign PDFs | Lifetime License | 1 Windows PC | 1 User [PC Online code]
  • EDIT text, images & designs in PDF documents. ORGANIZE PDFs. Convert PDFs to Word, Excel & ePub.
  • READ and Comment PDFs – Intuitive reading modes & document commenting and mark up.
  • CREATE, COMBINE, SCAN and COMPRESS PDFs
  • FILL forms & Digitally Sign PDFs. PROTECT and Encrypt PDFs
  • LIFETIME License for 1 Windows PC or Laptop. 5GB MobiDrive Cloud Storage Included.

Python example

Install Requests if needed with python -m pip install requests. Save the following as convert_basic_auth.py, replace the placeholders, and run python convert_basic_auth.py.

import requests

api_key = "YOUR_PDFSHIFT_API_KEY"
payload = {
    "source": "https://www.example.com/protected-page",
    "auth": {
        "username": "YOUR_PAGE_USERNAME",
        "password": "YOUR_PAGE_PASSWORD",
    },
}

response = requests.post(
    "https://api.pdfshift.io/v3/convert/pdf",
    headers={"X-API-Key": api_key},
    json=payload,
    timeout=90,
)
response.raise_for_status()

with open("protected-page.pdf", "wb") as pdf_file:
    pdf_file.write(response.content)

The binary write matters: a PDF is not plain text. raise_for_status() stops the script on an HTTP error instead of silently saving an error response as if it were a PDF.

Request shape

{
  "source": "https://www.example.com/protected-page",
  "auth": {
    "username": "YOUR_PAGE_USERNAME",
    "password": "YOUR_PAGE_PASSWORD"
  }
}

Send that JSON to https://api.pdfshift.io/v3/convert/pdf with your own PDFShift key in X-API-Key. The page’s username and password belong to the source-site authentication, not the PDFShift account.

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

Convert a page using an existing session cookie

If you already have a valid session cookie for a page you are authorized to access, pass the cookie name and value in the cookies array. PDFShift’s cookie guide also documents optional secure and http_only Boolean fields.

Rank #2
MobiPDF Lifetime - Professional PDF Editor for Windows | Edit, Sign & Convert PDFs | Best Adobe Acrobat Pro Alternative | Lifetime License
  • Edit PDFs with Ease. Modify text, images, and layouts directly within your PDF documents.
  • Convert & Organize. Export PDFs to Word, Excel, or ePub, and organize files with ease.
  • Read & Annotate. Enjoy intuitive reading modes and powerful tools to comment, highlight, and mark up PDFs.
  • Create & Manage PDFs. Create new PDFs, combine multiple files, scan documents, and compress for easy sharing.
  • Fill & Sign Forms. Complete forms and digitally sign documents with secure e-signature tools.
{
  "source": "https://www.example.com/protected-page",
  "cookies": [
    {
      "name": "SESSION_COOKIE_NAME",
      "value": "SESSION_COOKIE_VALUE",
      "secure": true,
      "http_only": true
    }
  ]
}

The flags are optional; include them when appropriate for the cookie you have. A session cookie is sensitive access information. Avoid putting it in a public repository, client-side code exposed to untrusted users, screenshots, or logs. The documented cookie example shows how to pass an existing cookie, not how to obtain one or guarantee that every site’s session behavior will work with the converter.

Keep credentials out of exposed code

  • Use placeholders in shared examples, and load real API keys and source credentials from protected server-side configuration or environment variables in your own application.
  • Do not embed a PDFShift key, page password, or session token in a web page or public source repository.
  • Only convert pages you are authorized to access. Consider whether your organization permits sending the relevant credentials and page content to a third-party conversion service.

Check the PDFShift API key separately

PDFShift identifies API users through the X-API-Key header. Its Help Center says the service moved to this header on 2025-05-06 and that omitting it can result in an unauthenticated request and a watermark. If a result is watermarked or the API rejects the request, first check that the header is present and the key is valid; then check the source-page credentials or cookie independently. PDFShift says you can check whether the key is being accepted with GET https://api.pdfshift.io/v3/credits/usage. See its Help Center explanation of watermark and API-key behavior.

Troubleshoot login screens, errors, and unexpected PDFs

The saved PDF shows a login page

Confirm which access mechanism the source uses. For an HTTP Basic Auth challenge, use the auth object. For an existing authenticated session, send the required valid cookie or cookies. Supplying a username and password this way is not evidence that an ordinary interactive login form will be completed automatically.

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

The API returns an HTTP error or a watermark

Check the X-API-Key header and key, then confirm that the source username/password or session cookie is current and valid. PDFShift documents 401/403 outcomes for API-key problems and says requests without the expected key may be treated as unauthenticated. A valid source-page credential does not fix a missing PDFShift API key.

Rank #3
Scrivar PDF Pro - Organize, Edit, Compress, Convert, Merge, eSign, OCR & 30+ tools | Lifetime License
  • EVERY PDF TOOL UNLOCKED - 30+ tools in one app: edit text and images, convert, merge, split, compress, sign, OCR, redact, watermark, batch process, and more. No feature gates, no upsells, nothing held back.
  • PAY ONCE, OWN FOREVER — A one-time purchase, not a subscription. Other apps runs $240/year — Scrivar is yours for life, with free updates included.
  • UNLIMITED eSIGN, BUILT IN — Send contracts and forms for signature and track every step. Recipients sign in their browser with no account or app needed. Replace DocuSign and save hundreds a year.
  • PC, MAC, AND WEB — Install on any Win 10/11 PC or macOS 11+ Mac (Intel or Apple Silicon), or work in your browser at scrivar.com. Same tools, same account, everywhere you work.
  • OCR + FULL OFFICE CONVERSION — Turn scanned documents into searchable, selectable text, and convert PDFs to and from Word, Excel, and PowerPoint with formatting kept intact.

The cookie is rejected

Make sure the cookie name and value are from the session that can access the target page and that the session has not expired. A cookie from another domain or an expired session may not authorize the requested URL. This is a practical consequence of session-based access, not a guarantee about compatibility with every site.

The page uses SSO, MFA, CAPTCHA, or a JavaScript login flow

The cited PDFShift documentation establishes Basic Auth and existing cookies; it does not establish support for automatically completing interactive login forms, SSO, MFA challenges, CAPTCHA, or JavaScript-driven authentication. Do not assume that putting a username and password in auth will handle those flows.

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

Or skip the browser setup

If you need a clean screenshot rather than a PDF of an authenticated page, ScreenshotNeo is a website screenshot API and MCP server for developers. One GET request can return a PNG, JPEG, WebP, or PDF; its clean-shot workflow accepts cookie and consent banners like a visitor and removes 60+ known consent platforms, newsletter popups, and chat widgets before capture. Each of those cleanup steps can be turned off. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses include X-Page-Verdict and X-Billed headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients.

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.

For a PDF capture, use the documented API endpoint and PDF format option; see the ScreenshotNeo API documentation for current parameters. A basic screenshot request looks like this:

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

ScreenshotNeo includes 1,000 screenshots a month free with no card; paid plans start at $5 for 3,000. Sign up for ScreenshotNeo’s free plan.

Quick Recap

Bestseller No. 1
PDF Extra 2024| Complete PDF Reader and Editor | Create, Edit, Convert, Combine, Comment, Fill & Sign PDFs | Lifetime License | 1 Windows PC | 1 User [PC Online code]
PDF Extra 2024| Complete PDF Reader and Editor | Create, Edit, Convert, Combine, Comment, Fill & Sign PDFs | Lifetime License | 1 Windows PC | 1 User [PC Online code]
READ and Comment PDFs – Intuitive reading modes & document commenting and mark up.; CREATE, COMBINE, SCAN and COMPRESS PDFs
$99.99
Bestseller No. 2
MobiPDF Lifetime - Professional PDF Editor for Windows | Edit, Sign & Convert PDFs | Best Adobe Acrobat Pro Alternative | Lifetime License
MobiPDF Lifetime - Professional PDF Editor for Windows | Edit, Sign & Convert PDFs | Best Adobe Acrobat Pro Alternative | Lifetime License
Edit PDFs with Ease. Modify text, images, and layouts directly within your PDF documents.; Convert & Organize. Export PDFs to Word, Excel, or ePub, and organize files with ease.
$99.99

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
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.