Skip to main content
Fetches the page the same way as /v1/web/scrape, then extracts what you asked for:
  • extract_rules run CSS or XPath selectors over the HTML and return data.
  • ai_extract_rules and ai_query ask an LLM about the page and return ai_extraction.
Billing works like a scrape, plus the AI extraction credits when AI is requested and succeeds. Broken selectors are rejected with 422 before anything is fetched.

Request Body

string
required
The page to extract from.
object
Field name → selector. A selector starting with / or ( is treated as XPath; anything else is CSS. CSS supports ::text and ::attr(name).For more control, pass an object instead of a string:
  • selector (required): the CSS or XPath selector.
  • type: css or xpath. Inferred when unset.
  • all: return every match as a list instead of the first one.
  • output: text (default) or html (the element’s outer HTML).
object
Field name → plain-language description. The AI returns a JSON object with exactly these keys.
string
A freeform question about the page. When combined with ai_extract_rules, the answer is added under an answer key.
boolean
default:false
Render the page in a browser before extracting. Use this for pages that build their content with JavaScript.
string
CSS selector to wait for before extracting (browser render).
string
ISO 3166-1 alpha-2 country code for the proxy exit.
string
default:"simple"
Proxy pool: simple, premium or ultra.
At least one of extract_rules, ai_extract_rules or ai_query is required. Unknown fields are rejected with 422.

Response

boolean
true when the page was fetched and extraction ran.
string
The final URL after redirects.
integer
HTTP status code of the fetched page.
object
One key per extract_rules field: the first match as a string, a list with all: true, or null when nothing matched. null when no extract_rules were given.
object
The AI’s JSON answer. null when no AI was requested.
string
The model that produced ai_extraction.
string
Why AI extraction failed, when it did. Selector results in data are still returned.
string
Engine that fetched the page.
integer
Credits charged for this request.
integer
Total time in milliseconds.

Examples

Error Responses