Skip to main content
Use Fetch to retrieve any URL through Browserbase’s infrastructure when you don’t need an interactive browser session. You can also ask Browserbase to return the response as markdown or structured JSON for downstream agents and pipelines. Browserbase routes requests with a real browser User-Agent by default. You can also configure custom headers, proxies, redirects, and SSL behavior.
Fetch doesn’t execute JavaScript and has a 5 MB content limit. Fetch also can’t convert PDF responses to markdown or structured JSON. For pages that require JavaScript rendering or are larger than 5 MB, use a browser session instead.

Getting started

Create a Fetch request with a URL and optional configuration:
Node.js
For pages behind a login, see Authenticated Fetch.

Request parameters

Output formats

Fetch returns the source response as raw by default. Set format: "markdown" for readable markdown, or set format: "json" with a schema for structured data. Browserbase bills markdown and JSON as Fetch Extract separately from raw Fetch. See the pricing table.
SDK support for format: "markdown" and format: "json" is available in the Node SDK starting in @browserbasehq/sdk v2.12.0 and in the Python SDK starting in browserbase v1.11.0.

Markdown output

format: "markdown" returns the fetched page content as markdown in the content field.
Node.js

Structured JSON output

format: "json" requires a schema. Browserbase returns the extracted result as structured JSON in the content field. A language model extracts the result from the fetched page content.
Node.js
schema is only valid when format is json. If you send a schema with raw or markdown, the request is rejected.

Proxies

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

Authenticated Fetch

Fetch pages that require a login with saved browser session state.

Response

A successful response includes the page content along with metadata:
The response envelope stays the same across all formats. What changes is the value stored in content:
  • raw: the upstream response body
  • markdown: markdown generated from the fetched page
  • json: a structured JSON object matching the schema you requested

Response fields

Error handling

Fetch returns structured errors when something goes wrong.
If the response body exceeds 5 MB, you’ll receive a 502 error:
To handle this, catch the error and fall back to a browser session:
Node.js
The target page must respond within 60 seconds. If it takes longer, you’ll receive a timeout error:
If you consistently hit this timeout, consider using a browser session instead. Browser sessions support long-running page loads and JavaScript-heavy content.
If the target site has a TLS certificate issue (self-signed, expired, etc.), you’ll see an SSL error:
To resolve this, set allowInsecureSsl to true in your request:
Only enable allowInsecureSsl when you trust the target site. Disabling certificate verification removes a layer of protection against man-in-the-middle attacks.

Limits

  • Content size: 5 MB maximum. Responses exceeding this limit return a 502 error. See Content Too Large for how to detect and fall back to a browser session.
  • Timeout: 60 seconds. Pages that take longer to respond will return a 504 error.
  • No JavaScript execution: Fetch never renders the page in a browser. For pages that require JavaScript rendering, use a browser session.
  • No PDF conversion: Fetch can’t convert PDF responses to markdown or structured JSON. For PDF content, use a browser session.

API reference

Fetch a page

Full API reference for the POST /v1/fetch endpoint.

When to use Fetch

Use Fetch when you need page content, the page doesn’t require interaction, and performance and cost matter. Think about Search -> Fetch -> Browsers
  • Search: Find relevant sources (website, news, docs).
  • Fetch: Quickly extract content from most pages, and filter out low-value results.
  • Browsers: Log in to portals with Agent Identity, navigate complex pages, and extract the hard-to-reach data.

Need more help deciding which API?

Read the full guide for examples of which API to use.

Search

Find web pages for your browser workflow.