Scrape a page
scrapeRead one web page and hand it back as markdown, HTML, plain text, its links, a screenshot, a PDF, or the fields you ask for, read off the page by a model. engine: "auto" (the default) makes a plain HTTP request first and re-reads the page in a real Chromium when the body turns out to be a JavaScript shell, so you pay for a browser only when the page needed one. To send a search form or a JSON query, use method: "POST" with a body; to download a file exactly as the site sent it, ask for formats: ["raw"]. A link to a PDF or a Word file is read into text too, headings and paragraphs included. To click a cookie banner, type into a search box or run a script before the page is read, send browser.actions. Every request leaves through a residential proxy, or through your own with proxy: { pool: "custom", server }. The answer says which engine replied, where the page finally was and what it cost.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"url": "<url>"
},
"name": "scrape"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | The page to read. An http(s) URL. Private and loopback hosts are refused. | |
| body | No | What a POST sends, at most 64 KB. Set its type in `headers`: `{"content-type": "application/json"}` for JSON, or `application/x-www-form-urlencoded` for a form. If the site redirects, a 301, 302 or 303 reads the next page with GET and without the body; a 307 or 308 sends it again only if the protocol, host and port stay the same, and otherwise stops and names the new address. | |
| proxy | No | Where the request leaves from. Defaults to the managed residential pool. | |
| retry | No | How many extra tries to give a page the site blocks, each from a different address. 0 (the default) takes the site's first no as the answer. A blocked page costs nothing, so a try that is blocked again is free, but it takes as long as the first one did, so the call can run that many times longer. Once your `browser.actions` steps click, type, press a key or run a script on a page, it is not tried again, so nothing is done twice. If one of your scripts ran in it, the block is charged. | |
| engine | No | How to read it. "fetch" is a plain HTTP request; "browser" renders the page in a real Chromium; "auto" (the default) fetches first and escalates to the browser when the body turns out to be a JavaScript shell, billing whichever engine answered. A POST and "raw" always use "fetch", so leave it out for them. | |
| expect | No | What the page should answer with. Set `"json"` when you are reading an API: anything else that comes back (a maintenance notice, a "checking your browser" page, a login form) is then not your answer. It costs nothing, and we try again from another address instead of handing you a page you cannot parse. Without it, whatever the page returns is your answer. | |
| maxAge | No | The oldest copy of the page you accept, in milliseconds, up to 3600000 (one hour). If we still hold a copy of the same URL that your account read within that time, from the same country and with the same engine, you get it back for 0 credits and the answer says `cached: true`. If not, we read the page now and keep a copy for up to an hour, unless the page still needs JavaScript (`metadata.needsJs`). We may drop a copy sooner, to make room or on a deploy, and a batch keeps its own copies, apart from single calls. `0` always reads the page now, and keeps the copy for the calls after it. `extract` is still charged, because the model reads the copy again. Leave `maxAge` out to read the page fresh every time. A POST, or a call with `headers`, your own proxy, `browser` options, a screenshot, a PDF, `raw` or `escalate: false`, is always read fresh. | |
| method | No | The HTTP method. "POST" sends `body` to the URL, for a search form or a JSON query. It is sent once: never retried and never sent again another way, because sending it twice could repeat what it did. | GET |
| browser | No | How to render it. Only the browser engine reads these. With `auto` they apply if the page turns out to need one, except `actions`, which always use the browser. | |
| extract | No | What to pull out of the page, for the "extract" format. A model reads the page and fills in the shape you asked for. Give it a JSON Schema, a sentence, or both. It reads what the page says; it does not do arithmetic over it, so ask for the numbers and add them up in your own code. | |
| formats | No | What to hand back. "screenshot" and "pdf" come back as base64 and need the browser engine; asking for both costs no more than one. "extract" is the page read into fields by a model, and needs an `extract` block saying which ones. A link to a PDF or a Word (.docx) file is read into text, so the text formats work on it too. We read files up to 25 MB, and from a PDF the first 200 pages and the first 5 million characters. Reading a file costs what the engine costs: 1 credit with fetch, 5 with the browser. A Word file that holds more than 32 MB once unzipped answers FILE_TOO_LARGE, and a file link that answers a short web page instead of the file answers UPSTREAM_BLOCKED, both at no charge. A dead link is the exception: its 404 or 410 page is the site's answer, and comes back with that status at the fetch price. "raw" is the file exactly as the site sent it, as base64 with its content type: a PDF report, an image, a spreadsheet. It uses the fetch engine and holds up to 5 MB; a larger file answers FILE_TOO_LARGE at no charge, never cut short. | |
| headers | No | Extra request headers to send to the page, such as an authorization token, a cookie or a custom user agent. The connection's own headers cannot be set. | |
| escalate | No | Whether to try again a different way when the first attempt is blocked. On by default. `false` stops after one try. The site's refusal is your answer, and it costs nothing, unless your own `browser.actions` script ran in the page first. It is how you bound a call: with `auto`, trying again is what charges the browser price instead of the fetch one. A POST is sent once, so it is off for a POST. | |
| timeoutMs | No | How long to give the page before giving up, in milliseconds. A page that never arrives costs nothing, unless your own `browser.actions` script ran in the page first. | |
| excludeTags | No | CSS selectors for the parts of the page to leave out of `markdown`, `text` and `extract`, such as `[".comments", "#newsletter"]`. Up to 20 selectors, 256 characters each. | |
| includeTags | No | CSS selectors for the parts of the page to keep, such as `["h1", ".price"]`. `markdown`, `text` and `extract` then hold only what they match, in page order, and `onlyMainContent` no longer applies. Hidden parts are never kept. Up to 20 selectors, 256 characters each. | |
| onlyMainContent | No | Read only the page's main content into `markdown`, `text` and `extract`: the article or the product, without the menus, ads and related links around it. On by default. Set `false` for the whole page. When the main content is under 50 words, you get the whole page instead. `html` and `links` always hold the whole page. |