Web Page Fetch

GET/gateway/v1/web/fetch

Fetches a web page and converts it to clean, LLM-friendly markdown.

Options: - `target_selector` — extract specific page sections - `remove_selector` — strip unwanted elements

Returns 400 if the URL is invalid or unreachable.

Query Parameters

urlstringrequired

URL to fetch and parse

Example: https://ethereum.org
target_selectorstring

CSS selector to extract specific content

Example: article.main-content
remove_selectorstring

CSS selector to remove unwanted elements

Example: nav,footer,.ads
wait_for_selectorstring

CSS selector to wait for before extracting

Example: .content-loaded
timeoutinteger

Request timeout in milliseconds

Example: 5000
Web Page Fetch
const options = {method: 'GET'};

fetch('https://api.asksurf.ai/gateway/v1/web/fetch?url=https://ethereum.org&target_selector=article.main-content&remove_selector=nav,footer,.ads&wait_for_selector=.content-loaded&timeout=5000', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
OK
{
  "$schema": "https://example.com/schemas/DataObjectResponseWebFetchResultItem.json",
  "data": {
    "content": "<string>",
    "title": "<string>",
    "url": "<string>"
  },
  "meta": {
    "cached": true,
    "credits_used": 123,
    "empty_reason": "<string>"
  }
}