Web web Scrape API
Scrape any public web page as markdown, HTML, links or a screenshot. Call the Web web Scrape API for JSON. From 1 credit per call.
Request
url is required.
Response
If successful, the response body contains the standard envelope.data contains markdown, html, rawHtml, links, screenshot, isTruncated and metadata.
The following example is a real response, truncated: each list shows one item and long strings are cut.
Optional parameters
Billing
A successful request consumes 1 credit for most pages. 2 or 3 credits when a page takes more work to load, and 15 credits for the hardest pages to reach. A read with a screenshot, actions or waitFor costs 3 credits, or 15 on the hardest pages to reach. An answer from a stored copy costs 1 credit. A page that cannot be read costs nothing. creditsUsed shows what the call cost, up to 15 credits. Requests that fail, or that return no items, are not billed.Pagination
This method is not paginated. A single request returns the complete result.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Cut every text value in the response to this many characters. A value that was cut ends with …, and a page whose text was cut has isTruncated set to true. A screenshot is never cut. Leave it out to get the full text.
x >= 1Body
The page or PDF to read, such as https://bun.com/docs.
What to return: markdown (clean page text), html (the cleaned page), rawHtml (the page as sent), links (every link on the page) and screenshot (a JPEG of the visible page, as base64). Send { "type": "screenshot", "fullPage": true } for the whole page. A screenshot costs 3 credits, or 15 on the hardest pages to reach. A PDF comes back as markdown only.
1 - 5 elementsmarkdown, html, rawHtml, links, screenshot Keep only the page's main content, without menus, headers, footers and ads.
Keep only the parts of the page that match these CSS selectors, such as article or .price. When set, onlyMainContent is not applied.
1 - 20 elements1 - 200Remove the parts of the page that match these CSS selectors, such as .comments.
1 - 20 elements1 - 200Extra milliseconds to wait before reading, for pages that load their content late. To wait for an element, add a wait action with a selector. A read that waits costs 3 credits, or 15 on the hardest pages to reach.
0 <= x <= 10000How long to keep trying, in milliseconds. Pages behind a bot check can need 10 to 30 seconds the first time.
10000 <= x <= 60000Accept a stored answer up to this many milliseconds old. 0 always reads the page live. metadata.cacheState says which one you got.
0 <= x <= 172800000Where to read the page from. The default is the United States.
Steps to run on the page, in order, before reading it: { "type": "wait", "milliseconds": 500 }, { "type": "wait", "selector": ".results" }, { "type": "click", "selector": "button.more" }, { "type": "write", "text": "tides" }, { "type": "press", "key": "Enter" } or { "type": "scroll", "direction": "down" }. A read with actions costs 3 credits, or 15 on the hardest pages to reach.
1 - 20 elements- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
Cut the markdown at this many characters; isTruncated says when that happened.
500 <= x <= 1000000