Skip to main content
Use a saved login session to fetch pages behind a login. Browserbase stores this login state in a context, and the API refers to it with contextId.

Fetching with a context

Pass a contextId to fetch pages that require a login. Browserbase calls the saved login state a context. Fetch sends only the cookies saved in that context. It follows normal browser cookie rules: each cookie goes only to the domains and paths it belongs to, including across redirects, and Fetch drops expired cookies.
Node.js
How it works:
  • Fetch uses the cookies saved when the browser session ends. Log in with a browser session that uses the context with persist: true.
  • Fetch is read-only. Fetch doesn’t write cookies the site sets during a request back to the context.
  • Fetch requires a context saved on or after September 1, 2026. To use an older context, run one browser session with that context and persist: true. The context works with Fetch after that session ends.
  • Bring-your-own-storage uses your existing role. If your project stores contexts in your own S3 bucket, Fetch reads them with the role you configured for it. Fetch only needs s3:GetObject on your contexts bucket, which the BYOS setup guide already grants.
Errors specific to fetching with a context:
Some sites authenticate data requests with tokens that the page’s JavaScript creates per session, such as an Authorization header. Fetch only sends cookies, so it can’t authenticate those requests. Use a browser session with the saved login for those sites.

Proxies

Route Fetch requests through Browserbase’s proxy network or target a specific location.

Fetch

Return page content without an interactive browser session.