Skip to main content
Use the Browser Context Profiles API to create persistent browser state, set it up once, and reuse it in future TinyAgent API runs. The happy path is simple: create a profile, save a logged-in setup session, then pass use_profile: true when you run automation.
This page covers the setup flow. For the exact request/response schema of every profile endpoint, see Full API Spec under TinyAgent Reference.

Browser Context Profiles overview

Learn when to use Browser Context Profile state

Vault Credentials

Add stale-session repair

API setup lifecycle

Browser Context Profiles are API-controlled saved state. The hosted setup UI is a manual helper; API users should bring their own Playwright, Puppeteer, or CDP controller and connect to the setup session’s cdp_url. Use base_url only for TinyFish HTTP session endpoints such as /pages; do not pass base_url to Playwright.
1

Create or list profiles

Create a named Browser Context Profile with POST /v1/profiles, or list existing profiles and choose one.
2

Start setup

Call POST /v1/profiles/{profileId}/setup-session and keep the returned session_id, cdp_url, base_url, timeout_seconds, and expires_at.
3

Connect and log in

Connect your browser automation framework to cdp_url, then log in manually or programmatically.
4

Save or discard

Save with POST /v1/profiles/{profileId}/save and { "session_id": "..." }. Cancelling setup or letting it time out discards unsaved setup state.
5

Run with saved state

Pass use_profile: true, or pass both use_profile: true and profile_id for a specific profile.

Set up a profile

Start a setup browser with POST /v1/profiles/{profileId}/setup-session and a target url. The response includes a cdp_url — connect to it with Playwright, Puppeteer, Selenium, or another CDP client. For example, with Playwright:
After login, save the setup session with POST /v1/profiles/{profileId}/save and the session_id from the setup response.

Save, cancel, or time out

The setup browser is temporary. If you do not save it before expires_at, or if you cancel it with POST /v1/profiles/{profileId}/setup-session/cancel, TinyFish discards the unsaved setup state. Cancelling a setup session that has already ended usually returns { "cancelled": true }. Saving a session again after a successful save usually returns the first save’s result. New sites you pass in signed_in_sites are still checked against what the first save captured, and recorded if they pass. If that result is no longer available, or the profile was deleted, you get the usual not-found error.

Run with a Browser Context Profile

Pass use_profile: true to use your default profile, or add profile_id for a specific one — see Create a Google Form With a Signed-In Account for a full worked example.
If use_profile: true is set and no default profile exists, the run returns 400. Create a profile and set it as default first.

Pair with Vault

For authenticated workflows, pair Browser Context Profiles with Vault so stale sessions can be repaired:
The Browser Context Profile starts the run with saved logged-in state. If the session expires and a matching Vault credential is available, TinyFish can use the credential to sign in again and repair the saved state for future runs.

Upload cookies manually

Use POST /v1/profiles/{profileId}/upload when you already have exported browser state and do not need to open a setup browser. Manual upload supports cookies plus local and session storage.

Common errors

Next steps

Full API Spec

Exact request/response schema for every profile endpoint

Browser Context Profiles overview

Learn when to use Browser Context Profile state

Vault Credentials

Add stale-session repair