Overview
Fetch lets you grab the content of any URL through Browserbase’s infrastructure without creating a browser session. It’s ideal for quick page retrievals where you don’t need interactivity — just the content. Requests are routed through Browserbase with a real browser User-Agent by default, and you can optionally configure custom headers, proxies, redirects, and SSL behavior.Fetch retrieves the raw HTTP response and does not execute JavaScript. It also has a 1 MB content limit. For pages that require JavaScript rendering or are larger than 1 MB, use a browser session instead.
Request
Send a request with a URL and optional configuration:- Node.js
- Python
- cURL
SDK
Request Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
url | string | required | The URL to fetch. |
allowRedirects | boolean | false | Whether to follow HTTP redirects. |
allowInsecureSsl | boolean | false | Whether to bypass TLS certificate verification. Set to true for sites with self-signed or expired certificates. |
proxies | boolean | false | Route the request through Browserbase’s proxy network. |
Using Proxies
If a site is blocking your request or returning a403 status code, enable Browserbase’s proxy network by setting proxies: true:
- Node.js
- Python
- cURL
SDK
Enabling proxies may increase response time. If speed is critical and the target site doesn’t require a proxy, leave this disabled.
Response
A successful response includes the page content along with metadata:Response Fields
| Field | Type | Description |
|---|---|---|
statusCode | number | The HTTP status code returned by the target URL. |
headers | object | The HTTP response headers from the target URL. |
content | string | The page content. Text content is returned as a UTF-8 string; binary content is returned as a Base64-encoded string. |
contentType | string | The MIME type of the response (e.g. text/html; charset=utf-8). |
encoding | string | Either utf-8 for text content or base64 for binary content. |
Error Handling
Fetch returns structured errors when something goes wrong.Content Too Large (502)
Content Too Large (502)
If the response body exceeds 1 MB, you’ll receive a 502 error:To handle this, catch the error and fall back to a browser session:
- Node.js
- Python
SDK
Gateway Timeout (504)
Gateway Timeout (504)
The target page must respond within 10 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.
SSL Error (502)
SSL Error (502)
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:Limits
- Content size: 1 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: 10 seconds. Pages that take longer to respond will return a 504 error.
- No JavaScript execution: Fetch retrieves the raw HTTP response. For pages that require JavaScript rendering, use a browser session.
API Reference
Fetch a Page
Full API reference for the POST /v1/fetch endpoint.