API Documentation

ZenRows API makes scraping a breeze. A single endpoint handles all the magic - https://api.zenrows.com/v1/.

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

Overview

parameter type default description
apikey required string Get Your Free API Key learn more
url required string http://example.com/ The URL you want to scrape learn more
js_render boolean false Render the Javascript on the page with a headless browser (5 credits/request) learn more
premium_proxy boolean false Use premium proxies to make the request harder to detect (10-25 credits/request) learn more
proxy_country string "" Geolocation of the IP used to make the request. Only for Premium Proxies. learn more
css_extractor string (JSON) "" Define CSS Selectors to extract data from the HTML. learn more
autoparse boolean false Use our auto parser algorithm to automatically extract data. learn more

Getting Started

Only two parameters that are required to get started with ZenRows API: apikey and url to start using the API.

API Key required

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.

https://api.zenrows.com/v1/?apikey=YOUR_KEY&url=https://www.zenrows.com

URL required

The URL is the page you want to scrape. It needs to be encoded.

https://api.zenrows.com/v1/?apikey=YOUR_KEY&url=https://www.zenrows.com

Javascript Rendering

Some websites rely heavily on Javascript to load content. Enable this feature if you need to extract data that are loaded dynamically.

You can enable Javascript by adding &js_render=true to the request. This request costs 5 credits.

https://api.zenrows.com/v1/?apikey=YOUR_KEY&url=https://www.zenrows.com&js_render=true

Premium Proxies

Some websites are harder to scrape and block datacenter IPs. Premium Proxies come in handy to solve this problem. As the name suggests, these proxies come straight from ISP providers.

You can easily use Premium Proxies adding &premium_proxy=true to the request. This request costs 10 credits.

https://api.zenrows.com/v1/?apikey=YOUR_KEY&url=https://www.zenrows.com&premium_proxy=true

Geolocation

Some content is specific to a region. In these cases, you may want to make your request from a given country.

You only need to add &premium_proxy=true&proxy_country=us to the request. Geolocation requires Premium Proxies enabled (it costs 10-25 credits).

https://api.zenrows.com/v1/?apikey=YOUR_KEY&url=https://www.zenrows.com&premium_proxy=true&proxy_country=us

Data Extraction: CSS Selectors

You can use CSS Selectors for data extraction. In the table below, you will find a list of examples of how to use it.

You only need to add &css_extractor={"links":"a @href"} to the request to use this feature.

Here are some examples

extraction rules sample html value json output
{"divs":"div"} <div>text0</div> text {"divs": "text0"}
{"divs":"div"} <div>text1</div><div>text2</div> text {"divs": ["text1", "text2"]}
{"links":"a @href"} <a href="#register">Register</a> href attribute {"links": "#register"}
{"hidden":"input[type=hidden] @value"} <input type="hidden" name="_token" value="f23g23g.b9u1bg91g.zv97" /> value attribute {"hidden": "f23g23g.b9u1bg91g.zv97"}
{"class":"button.submit @data-v"} <button class="submit" data-v="register-user">click</button> data-v attribute with submit class {"class": "register-user"}
{"class":"button.submit @data-v"} <button class="submit" data-v="register-user">click</button> data-v attribute with submit class {"class": "register-user"}
{"emails":"a[href^='mailto:'] @href"} <a href="mailto:[email protected]">email 1</a><a href="mailto:[email protected]">email 2</a> href attribute for links starting with mailto: {"emails": ["[email protected]", "[email protected]"]}

If you are interested in learning more, you can find a complete reference of CSS Selectors here.

https://api.zenrows.com/v1/?apikey=YOUR_KEY&url=https://www.zenrows.com&css_extractor=%7B%22images%22%3A%22img%20attr%3Asrc%22%2C%22links%22%3A%22a%20attr%3Ahref%22%7D

Data Extraction: Auto Parsing

ZenRows API will return the HTML of the URL by default. Enabling Autoparse uses our extraction algorithms to parse data in JSON format automatically.

Add &autoparse=true to the request for this feature.

https://api.zenrows.com/v1/?apikey=YOUR_KEY&url=https://www.amazon.com/dp/B01LD5GO7I/&autoparse=true