For AI agents: a documentation index is available at /llms.txt
Skip to main content

Browse Cloudflare Access-Protected Pages

Access pages protected by Cloudflare Access zero-trust policies by passing Service Token credentials or reusing a saved authenticated profile.

Prerequisites
  • A Browserless API token from your account dashboard
  • Cloudflare Access Service Token credentials (CF-Access-Client-Id and CF-Access-Client-Secret) or a valid Browserless authenticated profile for the protected site

Steps

There are two approaches depending on your Cloudflare Access configuration:

  • Service Tokens — machine-to-machine credentials issued by your Cloudflare team. Inject them as HTTP headers on every request.
  • User sessions — save a logged-in browser state to a Browserless profile and reuse it. See Save Logins to Authenticated Profiles.

Use the REST API with Cloudflare Access service token headers to reach protected pages.

View Full Code on GitHub

1. Use a saved authenticated profile

If you have a Browserless profile saved after logging in through Cloudflare Access, append profile= to any request:

curl -X POST \
"https://production-sfo.browserless.io/screenshot?token=YOUR_API_TOKEN_HERE&profile=cf-access-profile" \
-H "Content-Type: application/json" \
-d '{ "url": "https://internal.example.com/dashboard" }' \
--output dashboard.png

2. Inject Service Token headers

For machine-to-machine access, use the /content endpoint with setExtraHTTPHeaders to pass the token on every navigation:

curl -X POST \
"https://production-sfo.browserless.io/content?token=YOUR_API_TOKEN_HERE" \
-H "Content-Type: application/json" \
-d '{
"url": "https://internal.example.com/dashboard",
"setExtraHTTPHeaders": {
"CF-Access-Client-Id": "YOUR_CF_CLIENT_ID.access",
"CF-Access-Client-Secret": "YOUR_CF_CLIENT_SECRET"
}
}'

Next steps