Skip to main content

Search the web

POST 

/v1/search

Searches the web and optionally extracts the full content of every result in the same call. Accepts JSON or form-encoded bodies.

Every call is written to your usage records — including the query itself — so a failed search can be traced back to what you searched for. Retention follows your usage-record retention (12 months by default).

Request body​

8 of 8
querystringrequired
The query.
Values
1–256 characters
max_resultsinteger
Upper bound, not an exact count — fewer results are still a success.
Default
10
Values
1 … 100
sourcestring
Which corpus to search. time_range is rejected together with shopping/scholar; country is rejected with scholar.
Default
web
Values
web, news, shopping, scholar
countrystring
Restricts results to a country. Lowercase is rejected.
Values
uppercase two-letter ISO code from the supported list
languagestring
Preferred result language.
Values
lower-case language code, e.g. en, zh-cn, pt-br
time_rangestring
Recency filter.
Values
hour, day, week, month, year
extract_contentboolean
Also extract the full content of each result.
Default
false
extract_optionsobject
Options for the inline extraction (see below).
Values
only allowed when extract_content: true

extract_options accepts formats (markdown, raw_html, clean_html, links; no duplicates), only_main_content, include_tags, exclude_tags, advanced_mode, max_age_ms (0 … 172800000), timeout_ms (1000 … 120000) and wait_for_ms (0 … 30000, at most half of timeout_ms). headers, url and country are not accepted inside extract_options.

It only takes effect with extract_content: true. When extraction is off (or the flag is omitted) the field is dropped before the request reaches the fetch service, so a stale, default-filled object cannot fail the call.

Reading the result​

  • data.outputs is an array of results, each with position, title, url, snippet and — for news — a human-readable date.
  • With extract_content: true every result also carries extract; when that single extraction fails it is reported per result (extract.success: false with extract.code / extract.message) while the search itself still succeeds.
  • Zero results is a success: data.outputs is null and data.meta.count is 0.

Request​

Responses​

Search results, possibly a platform-level failure in data

Response Headers
    Cache-Control

    Always no-store — no intermediary may cache these responses.

    X-Upstream-Request-Id

    The fetch service's own request identifier for this call. Quote it together with the envelope's request_id in support requests.