API Documentation
Overview
Here is a complete list of parameters you can use to customize your requests.
PARAMETER | TYPE | DEFAULT | DESCRIPTION |
---|---|---|---|
apikey required | string | Get Your Free API Key | |
url required | string | The URL you want to scrape | |
js_render | boolean | false | Render the JavaScript on the page with a headless browser. |
custom_headers | boolean | false | Enable custom headers to be passed to the request. |
premium_proxy | boolean | false | Use premium proxies to make the request harder to detect. |
proxy_country | string | Geolocation of the IP used to make the request. Only for Premium Proxies. | |
session_id | integer | Send a Session ID number to use the same IP for each API Request for up to 10 minutes. | |
device | string | “desktop” | Use either desktop or mobile user agents in the headers. |
original_status | boolean | false | Returns the status code provided by the website. |
allowed_status_codes | string | Returns the content of the target page even if it fails with a status code on the provided list. | |
wait_for | string | Wait for a given CSS Selector to load in the DOM before returning the content. | |
wait | integer | 0 | Wait a fixed amount of time before returning the content. |
block_resources | string | Block specific resources from loading using this parameter. | |
json_response | string | false | Get content in JSON including XHR or Fetch requests. |
css_extractor | string (JSON) | Define CSS Selectors to extract data from the HTML. | |
autoparse | boolean | false | Use our auto parser algorithm to automatically extract data. |
markdown_response | boolean | false | Get the content parsed as Markdown instead of HTML. |
screenshot | boolean | false | Returns an above-the-fold screenshot of the target page. |
screenshot_fullpage | boolean | false | Returns a full-page screenshot of the target page. |
screenshot_selector | string | Returns a screenshot of a specific CSS Selector of the target page. |
Getting started
ZenRows API makes scraping a breeze. You only need two pieces:
- An API key
- The encoded URL you want to scrape
ZenRows offers both API and Proxy modes as a way of connection. Plus SDKs for Python and Node.js, which make things easier for newcomers. You will find examples for all of them below.
Headers, cookies included, returned by the target website are prefixed with Zr-
. ZenRows will also add a header Zr-Final-Url
showing the final visited URL, which can change from the original in case of redirects.
Zr-Content-Encoding: gzip
Zr-Content-Type: text/html
Zr-Cookies: _pxhd=Bq7P4CRaW1B...
Zr-Final-Url: https://www.example.com/
API Key
To access API functionality, you need to have a valid API Key. This unique key will keep all your requests authorized.
Start using the API by creating your API Key now.
URL
The URL is the page you want to scrape. It needs to be encoded. Some HTTP clients or our SDKs will do that automatically for you.