Scrape HTML
Retrieve the raw HTML of any webpage with the Scrape HTML endpoint, supporting browser rendering, geo-targeting, and waiting for DOM selectors.
This endpoint scrapes a target URL with Scrape HTML that supports browser rendering, geo-targeting via proxy, and waiting for specific DOM selectors before extracting content.
Note
- Use the Scraper API Server (
https://api.mrscraper.com) host when calling this endpoint. - This is the same endpoint as the
Scrape HTMLuse case in the Scraper API Playground.
Query Parameters
API token.
The full URL of the page you want to scrape. Must include the protocol (https://). You can also paste a cURL command here to auto-apply all settings.
uritrueRoutes the request through a real device to improve results on complex websites. On by default; set to false to use standard routing.
trueLoads the page in a real browser. Set true for JavaScript-heavy sites, SPAs, and pages that load content dynamically. Sending waitForSelector or waitForDelay also turns it on.
falseMaximum seconds to wait for the scrape before the request times out. Up to 330, after which the API stops waiting. Increase for slow or complex pages.
3001 <= value <= 330Opens the site's home page first to warm the session before loading the target URL. Useful for sites that expect a normal browsing session before deeper pages.
falseWaits until a specific CSS selector appears in the DOM before returning the page, such as #results. Up to 500 characters. Useful for content that loads asynchronously after the initial page load. Turns on browser rendering.
length <= 500Extra seconds to wait after the page loads, from 0 to 30. Decimals are allowed, such as 1.5. Turns on browser rendering.
0 <= value <= 30Routes the request to a specific scraper action, or simply flags it. Useful for separating analytics per domain.
Two-letter country code to load the page from, such as us or gb. Defaults to the United States. Send geoCode or proxyCountry; if you send both, they must match.
"us"2 <= length <= 2Two-letter country code of the proxy server, such as us or gb. Same as geoCode; if you send both, they must match. Defaults to the United States.
"us"2 <= length <= 2Saves the result to the Result tab.
trueServes a cached result of the same request when it is newer than this age, in milliseconds, such as 86400000 for 1 day. Up to 604800000 (7 days). Omit or send 0 to always scrape fresh. A cached result costs the same tokens as the original scrape.
0 <= value <= 604800000Maximum total tokens the scrape and its retries can use. Automatic retries are bounded by this cap, so the total tokens for a single run stay at or below the value you set. Omit for no limit.
1 <= valueMaximum number of retries for the request. Omit for no limit.
0 <= valueHeader Parameters
API token.
Response Body
text/html
application/json
application/json
curl -X GET "https://api.mrscraper.com/?token=string&url=http%3A%2F%2Fexample.com&html=true" \ -H "x-api-token: string""<!DOCTYPE html><html lang=\"en\"><head><title>Example Domain</title><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><style>body{background:#eee;width:60vw;margin:15vh auto;font-family:system-ui,sans-serif}h1{font-size:1.5em}div{opacity:0.8}a:link,a:visited{color:#348}</style></head><body><div><h1>Example Domain</h1><p>This domain is for use in documentation examples without needing permission. Avoid use in operations.</p><p><a href=\"https://iana.org/domains/example\">Learn more</a></p></div></body></html>"{
"error": "Unauthorized",
"message": "Invalid or missing API token",
"statusCode": 401
}{
"error": "Internal Server Error",
"message": "An unexpected error occurred",
"statusCode": 500
}Web Search GET
Run a search query with the Web Search endpoint and get ranked results with titles, URLs, descriptions, and sources, without scraping the results page yourself.
Scrape Markdown GET
Convert any web page into clean, LLM-friendly Markdown with the Scrape Markdown endpoint, stripping navigation, scripts, and ads for token-efficient AI input.