Skip to main content
GET
Search the web

Overview

/search runs a web search (Google results) and returns the results best first: each one’s url, title and description (the snippet the search engine shows). Set type=news for recent articles with their publisher and date. Ask for page content and every result page is scraped in the same request, exactly as GET /scrape would scrape it — markdown, a summary, links, structured JSON — and returned in scrape on its result. One call answers “find pages about X and give me their text”. Use /search when you need to find pages. When you need a researched answer that cites its sources, use POST /answers; when you already know the page, use /scrape.

Example requests

Example response

Search operators work in query as they do on Google: "exact phrase", -word, filetype:pdf, site:example.com. Results on your account’s blocklist are dropped, and the rest renumbered.

Scraping the results

Ask for content with formats on GET (formats=markdown,links, plus only_main_content and max_age), or a scrape_options object on POST — every option /scrape takes. Up to 10 results can be scraped in one request. Result pages are fetched in parallel within one deadline (45 s by default; timeout can shorten it). A page that cannot be fetched — blocked, too slow, not a page — gets a scrape_error with an error code instead of scrape, and is not charged. The search itself still succeeds.

Credits

A 10-result search costs 2 credits; with every page as markdown, 12.

GET /scrape

One page, every format. 1 credit.

POST /batch/scrape

Hundreds of known URLs as one job.

Authorizations

X-API-Key
string
header
required

Your Prefetch API key. Obtain one from the dashboard.

Query Parameters

query
string
required

What to search for, as you would type it into Google (1–400 characters). Search operators work ("exact phrase", -word, filetype:pdf). q is accepted too.

Example:

"best open source CRM"

limit
string

Results to return (1–50; 1–10 when results are scraped). Default: 10.

Example:

"10"

type
enum<string>

web (default) or news — recent articles with their publisher and date.

Available options:
web,
news
country
string

Two-letter country code to search from, e.g. us, de.

Example:

"us"

language
string

Two-letter language code for the results, e.g. en, de.

Example:

"en"

location
string

A city or region to search from, e.g. Berlin, Germany.

time_range
enum<string>

Only results from the past hour, day, week, month or year.

Available options:
hour,
day,
week,
month,
year
include_domains
string

Comma-separated domains to search within (up to 10).

Example:

"github.com,gitlab.com"

exclude_domains
string

Comma-separated domains to leave out (up to 10).

Example:

"pinterest.com"

formats
string

Scrape each result page into these formats (the /scrape formats: markdown, summary, html, raw_html, links, images, json, screenshot). Omit to return search results only.

Example:

"markdown"

only_main_content
string

With formats: strip navigation, sidebars and footers from each page. Default: true.

max_age
string

With formats: accept a stored copy of a page fetched at most this many milliseconds ago.

Example:

"86400000"

timeout
string

Give up after this many milliseconds (5,000–45000). Result pages still loading are returned with a scrape_error and not charged.

Example:

"30000"

Response

Results, best first.

success
enum<boolean>
required
Available options:
true
data
object
required
meta
object
required