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

Save Logins to Authenticated Profiles

Capture a logged-in browser state once — cookies, localStorage, session tokens — and reuse it across parallel sessions without re-entering credentials.

Prerequisites

Steps

Saving an authenticated profile works in two phases: first you create and save the profile with a live login session, then you reuse that profile in any future request.

Use the REST API to save and reuse authenticated browser profiles.

View Full Code on GitHub

1. Start a profile session

Create a named profile session. The response includes a WebSocket URL to connect a CDP client for the login flow:

curl -X POST \
"https://production-sfo.browserless.io/profile?token=YOUR_API_TOKEN_HERE" \
-H "Content-Type: application/json" \
-d '{ "name": "my-profile" }'

The response:

{
"id": "<session-id>",
"name": "my-profile",
"connect": "wss://production-sfo.browserless.io/session/connect/<id>?token=...",
"stop": "https://production-sfo.browserless.io/session/<id>?token=..."
}

2. Log in and save

Connect a CDP client (see the Puppeteer tab), complete the login, and call Browserless.saveProfile to persist the session.

3. Reuse the profile

Append ?profile=my-profile to any Browserless endpoint to start pre-authenticated:

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

Next steps