Web Search
Perform web searches and optionally scrape the results.
Performs a web search and returns results with optional content scraping.
POST /v1/tools/web_searchAuthentication
AuthorizationBearerrequiredAPI key as bearer token in the Authorization header. Create keys at
Manage API Keys.
Headers
Content-TypestringrequiredMust be application/json.
Body
querystringrequiredThe search query.
limitintegeroptionalDefault 10Maximum number of results to return. Range: 1 to 50.
sourcesstring[]optionalSources to search from.
categoriesobject[]optionalCategories to filter results.
include_domainsstring[]optionalOnly include results from these domains.
exclude_domainsstring[]optionalExclude results from these domains.
tbsstringoptionalTime-based search parameter (e.g., qdr:d for past day, qdr:w for past week).
locationstringoptionalGeographic location for search (e.g., us, uk).
countrystringoptionalCountry code for search.
timeoutintegeroptionalRequest timeout in milliseconds. Minimum: 1.
ignore_invalid_urlsbooleanoptionalDefault falseIgnore invalid URLs in results.
enterpriseobject[]optionalEnterprise search options.
scrape_optionsobjectoptionalOptions for scraping each search result. Accepts every web_scrape option except url; unknown keys are rejected with a 400. The most common ones:
scrape_options.formatsstring[]optionalOutput formats for scraped content.
markdownsummaryhtmlrawHtmllinksimagesscreenshotjsonchangeTrackingbrandingaudiovideoquestionhighlightsscrape_options.only_main_contentbooleanoptionalDefault falseExtract only the main content from scraped pages.
Response
idstringoptionalUnique request ID for this call.
data.webWebResult[]optionalWeb results. Present when sources includes web (the default).
data.newsNewsResult[]optionalNews results. Present when sources includes news.
data.imagesImageResult[]optionalImage results. Present when sources includes images.
warningstringoptionalSet when part of the search could not be completed.
Search Result Shape
interface WebResult {
url: string;
title: string;
description: string;
// With scrape_options, the scraped page fields of web_scrape:
markdown?: string;
html?: string;
raw_html?: string;
links?: string[];
metadata?: { title?: string; description?: string; source_url?: string; url?: string };
}
interface NewsResult {
title: string;
snippet: string;
url: string;
date: string;
image_url?: string;
position: number;
// With scrape_options, the same scraped page fields as WebResult.
}
interface ImageResult {
title: string;
image_url: string;
url: string;
image_width: number;
image_height: number;
position: number;
}Use Cases
- Research automation: Search and gather information programmatically
- Content aggregation: Collect content from multiple sources
- Competitive analysis: Monitor mentions and rankings
- RAG pipelines: Fetch real-time web data for AI context