Overview

Here is a complete list of parameters you can use to customize your requests.

PARAMETERTYPEDEFAULTDESCRIPTION
apikey requiredstringGet Your Free API Key
url requiredstringThe URL you want to scrape
js_renderbooleanfalseRender the JavaScript on the page with a headless browser (5 credits/request)
custom_headersbooleanfalseEnable custom headers to be passed to the request.
premium_proxybooleanfalseUse premium proxies to make the request harder to detect (10-25 credits/request)
proxy_countrystringGeolocation of the IP used to make the request. Only for Premium Proxies.
session_idintegerSend a Session ID number to use the same IP for each API Request for up to 10 minutes.
devicestring“desktop”Use either desktop or mobile user agents in the headers.
original_statusbooleanfalseReturns the status code provided by the website.
wait_forstringWait for a given CSS Selector to load in the DOM before returning the content.
waitinteger0Wait a fixed amount of time before returning the content.
block_resourcesstringBlock specific resources from loading using this parameter.
json_responsestringfalseGet content in JSON including XHR or Fetch requests.
window_widthinteger1920Set browser’s window width.
window_heightinteger1080Set browser’s window height.
css_extractorstring (JSON)Define CSS Selectors to extract data from the HTML.
autoparsebooleanfalseUse our auto parser algorithm to automatically extract data.
return_screenshotbooleanfalseReturn a full page screenshot of the target page.
resolve_captchabooleanfalseUse a CAPTCHA solver integration to automatically solve interactive CAPTCHAs in the 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.

# pip install zenrows
from zenrows import ZenRowsClient

client = ZenRowsClient("YOUR_ZENROWS_API_KEY")
url = "https://httpbin.io/anything"

response = client.get(url)

print(response.text)

URL

The URL is the page you want to scrape. It needs to be encoded. Some HTTP clients or our SKDs will do that automatically for you.

# pip install zenrows
from zenrows import ZenRowsClient

client = ZenRowsClient("YOUR_ZENROWS_API_KEY")
url = "https://httpbin.io/anything"

response = client.get(url)

print(response.text)