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 HTML use case in the Scraper API Playground.
GET
/

Query Parameters

token*string

API token.

url*string

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.

Formaturi
html*boolean
Defaulttrue
super?boolean

Routes the request through a real device to improve results on complex websites. On by default; set to false to use standard routing.

Defaulttrue
browserRendering?boolean

Loads 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.

Defaultfalse
timeout?integer

Maximum 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.

Default300
Range1 <= value <= 330
warmStart?boolean

Opens 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.

Defaultfalse
waitForSelector?string

Waits 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.

Lengthlength <= 500
waitForDelay?number

Extra seconds to wait after the page loads, from 0 to 30. Decimals are allowed, such as 1.5. Turns on browser rendering.

Range0 <= value <= 30
action?string

Routes the request to a specific scraper action, or simply flags it. Useful for separating analytics per domain.

geoCode?string

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.

Default"us"
Length2 <= length <= 2
proxyCountry?string

Two-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.

Default"us"
Length2 <= length <= 2
saveResult?boolean

Saves the result to the Result tab.

Defaulttrue
maxAge?integer

Serves 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.

Range0 <= value <= 604800000
tokenCap?integer

Maximum 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.

Range1 <= value
maxRetries?integer

Maximum number of retries for the request. Omit for no limit.

Range0 <= value

Header Parameters

x-api-token*string

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
}