Loading
Loading
Extract structured data from any website through a single API request. The API handles dynamic content rendering, JavaScript execution, proxy rotation, CAPTCHA solving, SSL handling, and browser-level interactions for consistent data extraction.
Send the target website URL and configuration parameters as query parameters. Pass the scraping instructions array in the request body. The response contains an extractedData object with content matching your specified extraction rules.
Pass your API key as the apiKey parameter in every request.
This is version v1.0 of the API.
The following sections describe every input accepted by the Web Scraper API. Query parameters configure browser behavior; the request body carries the scraping workflow.
The following query parameters configure the scraping behavior. Pass the target URL and optional settings as query string parameters in the request URL.
formatoptionalStringdefault: jsonResponse format: 'json'.
urlrequiredStringThe URL of the web page to scrape.
textoptionalBooleandefault: trueIf true, returns extracted text content instead of full HTML.
jsEnabledoptionalBooleandefault: falseIf true, enables JavaScript rendering for dynamic pages.
proxyoptionalBooleandefault: falseEnables proxy usage for requests.
sslIgnoreoptionalBooleandefault: falseIf true, ignores SSL certificate errors when scraping HTTPS sites. Only works if jsEnabled is true.
windowSizeoptionalStringdefault: Browser defaultBrowser viewport size in width/height format for rendered scraping sessions. Only works if jsEnabled is true.
adBlockoptionalBooleandefault: falseIf true, blocks ads and trackers during page load. Only works if jsEnabled is true.
captchaoptionalBooleandefault: falseIf true, enables automatic CAPTCHA solving. Only works if jsEnabled is true.
The request body is a JSON object that defines browser session settings and the scraping workflow. The instructions array contains the core scraping logic.
{
"instructions": [
{
"fill": {
"place": "//*[@id='nombre']",
"value": "google"
}
},
{
"click": "//*[@id='page']/div/div/section[1]/div/div/div/div[2]/div/div/form/div[2]/button"
},
{
"clickButtonByValue": {
"place": ".col-6:nth-child(2) > .col-12",
"value": "google.sv "
}
},
{
"wait": 1000
},
{
"extract": {
"html": "//*[@id='DivResultado']/div"
}
}
]
}blockUrloptionalArrayList of script or URL patterns to block during page load.
cookiesoptionalArrayList of cookies to be set in the browser session.
instructionsrequiredArrayList of step-by-step scraping instructions. Each object in the array represents an action to execute. Can be empty to return full page content.
When jsEnabled is set to true, each object in the instructions array can contain one or more of the following action fields. The actions are executed in sequence within a headless browser.
filloptionalObjectFills an input field with a value.
clickoptionalStringClicks an element using XPath or CSS selector.
clickIfExistoptionalStringClicks element only if it appears within a short timeout.
enteroptionalStringSends Enter key to the targeted element.
newTaboptionalBooleanSwitches to a newly opened browser tab.
moveToRelativeTaboptionalIntegerMoves between tabs relative to the current tab index.
waitoptionalIntegerPauses execution for the specified number of milliseconds.
waitForoptionalStringWaits until an element matching the selector becomes visible.
selectoptionalObjectSelects an option from a dropdown element.
jsExeoptionalStringExecutes custom JavaScript on the page.
conditionalCheckoptionalArrayExecutes conditional logic steps based on element state.
clickButtonByValueoptionalObjectClicks a button matching specific text or value.
generalImageCaptchaoptionalArrayInstructions for solving image captchas.
fillImageCaptchaoptionalArrayCaptures and fills CAPTCHA values automatically.
switchToIframeoptionalStringSwitches context into an iframe by name or ID.
switchToParentFrameoptionalBooleanReturns from an iframe to the parent context.
resolveAudioCaptchaoptionalObjectSolves audio CAPTCHA challenges.
screenshotoptionalStringCaptures a screenshot of the page.
saveimageoptionalStringSaves an image by selector or ID.
blockElementoptionalArrayList of CSS selectors or XPaths for elements to block or hide on the page. Example: [".description", "//input[@id='username']"]
extractoptionalObjectDefines what data to extract and how to extract it.
When a fill action is provided inside an instruction, the following sub-fields define the input target and value.
placerequiredStringXPath or CSS selector of the input field.
valuerequiredStringValue to enter into the input field.
When a select action is provided inside an instruction, the following sub-fields define the dropdown target and value.
placerequiredStringXPath or CSS selector of the parent or container element.
valuerequiredStringText or value to match for selecting the option.
When a generalImageCaptcha action is provided inside an instruction, each object in its array can contain the following fields.
imagePathoptionalStringPath or selector to the CAPTCHA image element.
textFieldoptionalStringSelector for the field where CAPTCHA text is entered.
imageUpdatePathoptionalStringSelector to refresh or update the CAPTCHA image.
captchaFailedPathoptionalStringSelector indicating a CAPTCHA failure so the solver can retry.
modeloptionalStringModel used for CAPTCHA solving. Available models: Model_1, Model_2, Model_3, Model_4, Model_5, Model_6, basicTnImageProcessing, basicPhImageProcessing.
When an extract action is provided inside an instruction, the following sub-fields define what content to extract and how to locate it.
htmloptionalStringCSS selector or XPath to extract HTML content. Example: "/html/body"
textoptionalStringCSS selector or XPath to extract text content. Example: "/html/body/div/div[2]/text"
user_dataoptionalStringCSS selector or XPath to extract user data. Example: "/html/body/div/div[2]"
When jsEnabled is false or omitted (static scraping), each object in the instructions array can use the following action fields. These do not require a browser environment.
postFormoptionalObjectSubmits a form using POST method. Provide the form’s XPath/CSS selector and input values.
getFormoptionalObjectSubmits a form using GET method. Provide the form’s XPath/CSS selector and input values.
getPageoptionalStringRetrieves page content.
extractoptionalObjectDefines what data to extract and how to extract it.
When a getForm or postForm action is provided inside an instruction, the following sub-fields define the form target and the data to submit.
selectorrequiredStringForm selector (XPath or CSS) identifying the form element.
datarequiredObjectObject containing the form input values. Each key is the field name and the value is the data to submit (e.g., { username: "myuser" }).
When an extract action is provided inside an instruction, the following sub-fields define what content to extract and how to locate it.
htmloptionalStringCSS selector or XPath to extract HTML content. Example: "/html/body"
textoptionalStringCSS selector or XPath to extract text content. Example: "/html/body/div/div[2]/text"
A successful request returns a 200 OK response with a JSON object containing the extracted data. The extractedData object is dynamic and reflects the field names defined in your extract instruction.
title (String), content (String), <key> (Array | String), links (Array), screenshot (String)
See the HTTP Status Codes documentation for a complete reference of common API errors and HTTP status codes.
please pass correct parameters
The CSS or XPath selector provided is incorrect or unparseable.
Timed out while finding or interacting with elements on the page.
Missing required fields in postForm or getForm instruction.
The target URL returned a non-200 HTTP response.
The instruction contains an invalid or unsupported method.
One or more required parameters are missing or invalid.
An I/O error occurred while processing the request.
CAPTCHA was attempted but failed after retries.
CAPTCHA instructions were provided but captcha is not enabled in parameters.
URL cannot be null or empty. Please enter a valid URL.
An unexpected error occurred. Proxy connection failed.
Scraping stopped due to an Unknown Exception [Protocol error (Page.navigate): Cannot navigate to invalid URL].
Wrong HTTP method was used on the endpoint.
The request was not completed within the expected time frame.
Too many requests. Please wait before making additional requests.