Skip to main content
The Search API is currently in private beta.
The Browserbase Search API lets you perform web searches programmatically and receive structured results directly — no browser session required. It’s designed for AI agents, research pipelines, and any workflow that needs real-time web search data. Send a POST request to /v1/search with your query. Authenticate with the same x-bb-api-key header used across the Browserbase API.
import { Browserbase } from "@browserbasehq/sdk";

const bb = new Browserbase({ apiKey: process.env.BROWSERBASE_API_KEY! });

const response = await bb.search({
  query: "browserbase",
  numResults: 10,
});

console.log(`Request ID: ${response.requestId}`);
for (const result of response.results) {
  console.log(`${result.title} - ${result.url}`);
}

Request Parameters

ParameterTypeRequiredDescription
querystringYesThe search query (1–200 characters)
numResultsintegerNoNumber of results to return (1–25, default: 10)

Response

FieldTypeDescription
requestIdstringUnique identifier for the request
querystringThe search query that was executed
resultsarrayList of search result objects
Each result object contains:
FieldTypeAlways presentDescription
idstringYesUnique identifier for the result
urlstringYesURL of the search result
titlestringYesTitle of the search result
authorstringNoAuthor of the content
publishedDatestringNoPublication date (ISO 8601)
imagestringNoImage URL
faviconstringNoFavicon URL

Combining Search with Browser Sessions

A common pattern is using the Search API to find relevant URLs, then opening them in browser sessions for deeper interaction — scraping content, filling forms, or taking screenshots.
import { Browserbase } from "@browserbasehq/sdk";
import { chromium } from "playwright-core";

const bb = new Browserbase({ apiKey: process.env.BROWSERBASE_API_KEY! });

const searchResponse = await bb.search({
  query: "browserbase documentation",
  numResults: 10,
});

for (const result of searchResponse.results) {
  const session = await bb.sessions.create();
  const browser = await chromium.connectOverCDP(session.connectUrl);
  const page = browser.contexts()[0].pages()[0];

  await page.goto(result.url);
  const content = await page.textContent("body");
  console.log(`Content from ${result.title}:`, content?.slice(0, 200));

  await page.close();
  await browser.close();
}

Rate Limits

The Search API is rate limited to 120 requests per minute per project. Exceeding this returns a 429 status code.
For high-volume use cases, space out your requests or implement exponential backoff in your retry logic.

Error Handling

Status CodeMeaning
200Success
400Invalid request (empty query, numResults out of range)
403Search API not enabled for your project
429Rate limit exceeded
503Search service temporarily unavailable
500Internal server error
try {
  const response = await fetch("https://api.browserbase.com/v1/search", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "x-bb-api-key": process.env.BROWSERBASE_API_KEY!,
    },
    body: JSON.stringify({ query: "browserbase" }),
  });

  if (!response.ok) {
    if (response.status === 429) {
      console.log("Rate limited — retrying after delay");
    } else if (response.status === 503) {
      console.log("Service temporarily unavailable — retrying");
    } else {
      console.error(`Search failed: ${response.status}`);
    }
    return;
  }

  const data = await response.json();
  console.log(data.results);
} catch (error) {
  console.error("Request failed:", error);
}