Web search with page content for AI

GET https://api.api.sh/web/v1/search
8 credits / call web data try it in the playground →

Searches the web for q and returns the top result pages read in full as clean markdown (or text / HTML), ready for an AI model or a RAG pipeline. Each item of results has the search position, title, url and description from the results page, then status (ok or failed), the page's own title, description, language, author and published date, the content under the key named by format (markdown, text or html), word_count and truncated (content is capped at 100,000 characters per page). A page that could not be read is listed with status: failed and error; the call succeeds when at least one page was read (pages_fetched, pages_failed). more_results lists the other search hits without content. When q is itself a URL, that page alone is read. engine says which search engine answered (auto uses Google first, then Bing, then DuckDuckGo). include_domains and exclude_domains limit the results to or away from some sites. Every response includes credits_used: the credits this call cost. Cost: 9 credits for the search plus 1 per page read (max_results; default 3 = 12 credits).

Parameters

nametypedescription
qrequired string Search query, or a URL to read directly. Example: what is retrieval augmented generation
max_results integer Result pages to read (1-10). Example: 3 Default: 3
country string Two-letter country to search and read the pages from. Example: US Default: US
language string Interface language of the search (e.g. en, de, pt-BR). Example: en Default: en
format markdown | text | html Format of each page's content (the content key has the same name). Example: markdown Default: markdown
time hour | day | week | month | year Only results from the past hour, day, week, month or year.
engine auto | google | bing | duckduckgo Search engine to use; auto falls back to the next engine when one returns nothing. Default: auto
include_domains string Only results from these domains (and their subdomains), comma separated, up to 10, e.g. nasa.gov,noaa.gov.
exclude_domains string No results from these domains (and their subdomains), comma separated, up to 10.

Every endpoint also takes fresh, raw, fields (see lean responses and caching).

Example

curl "https://api.api.sh/web/v1/search?q=what+is+retrieval+augmented+generation" \
  -H "x-api-key: $APISH_KEY"

Response

A JSON object with the fields described above, plus raw (the source's own data), cached, fetched_at and credits_used. Errors return {"success": false, "error": "…"} with the HTTP status (see errors). A lookup that ran but found nothing (404) costs the price above; refused calls and errors on our side are free (what's charged).

The fastest way to see the full response is the playground: it runs this endpoint with your account and shows the exact JSON.