Skip to main content
Save and reuse authenticated browser state across runs.

save

The save command saves the current browser session’s cookies and localStorage as a named auth profile. Load the profile later with --auth-profile to skip manual login.
npx libretto save linkedin.com --session app-login

When to use save

Only use save when you want to save or reuse authenticated browser state. A typical flow:
1

Open the site in headed mode

npx libretto open https://linkedin.com --headed --session app-login
2

Log in manually

The browser window is visible. Log in as usual.
3

Save the session

npx libretto save linkedin.com --session app-login
The profile is saved to .libretto/profiles/linkedin.com.json.
4

Use the profile in future runs

npx libretto run ./integration.ts --auth-profile linkedin.com

Flags

domain
string
required
The domain (or URL) used to name the saved profile. Passed as the first positional argument. Example: linkedin.com.
--session
string
required
The session to save. Use the same name you passed to npx libretto open --session.

Profile storage

Profiles are stored in .libretto/profiles/<domain>.json. They are:
  • Machine-local, not shared across environments or team members.
  • Git-ignored by default.
  • Subject to session expiry. If authentication stops working, repeat the login-and-save flow.
Profiles contain session cookies that are effectively credentials. The .libretto/ directory is already git-ignored, but double-check your .gitignore if you’re storing Libretto state in a non-standard location.