> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zenrows.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> The Zenrows HTTP API serves Fetch and Extract (extract=auto) at https://api.zenrows.com/v1/, Crawl at https://api.zenrows.com/v1/crawls, and Batch at https://async.api.zenrows.com/v1. Fetch, Extract, Crawl and Batch are described in OpenAPI 3.1 at https://www.zenrows.com/openapi.json and listed in the RFC 9727 API catalog at https://www.zenrows.com/.well-known/api-catalog. Every endpoint also has its own page under /api-reference with its schema. Use the spec for exact parameter names and types. Crawl's endpoints, parameters and errors are also at https://docs.zenrows.com/crawl/endpoints.md. To call Zenrows from an agent, connect the MCP server at https://mcp.zenrows.com/mcp. To search these docs from an agent, connect the docs MCP server at https://docs.zenrows.com/mcp. Agent skills for Zenrows are published at https://github.com/ZenRows/cli and install with `npx skills add ZenRows/cli`.

# Make Your First Request with Zenrows' Fetch

> Follow this step-by-step guide to make your first web scraping API call with Zenrows in Python, Node.js, Go, Java, PHP, Ruby, or cURL.

Learn how to extract data from any website using Zenrows' Fetch. This guide walks you through creating your first scraping request that can handle sites at any scale.

Zenrows' Fetch is designed to simplify web scraping. Whether you're dealing with static content or dynamic JavaScript-heavy sites, you can get started in minutes with any programming language that supports HTTP requests.

## 1. Set Up Your Project

### Set Up Your Development Environment

Before diving in, ensure you have the proper development environment and required HTTP client libraries for your preferred programming language. Zenrows works with any language that can make HTTP requests.

> [!NOTE]
>
> While previous versions may work, we recommend using the latest stable versions for optimal performance and security.

> [tab] Python
>
> Python 3 is recommended, preferably the latest version.
> Consider using an IDE like [PyCharm](https://www.jetbrains.com/pycharm/) or [Visual Studio Code](https://code.visualstudio.com/docs/languages/python) with the Python extension.
>
> ```bash theme={"theme":"css-variables"}
> # Install Python (if not already installed)
> # Visit https://www.python.org/downloads/ or use package managers:
>
> # macOS (using Homebrew)
> brew install python
>
> # Ubuntu/Debian
> sudo apt update && sudo apt install python3 python3-pip
>
> # Windows (using Chocolatey)
> choco install python
>
> # Install the requests library
> pip install requests
> ```
>
> > [!TIP]
> >
> > If you need help setting up your environment, check out our detailed [Python web scraping setup guide](https://www.zenrows.com/blog/web-scraping-python#setup).

> [tab] Node.js
>
> Node.js 18 or higher is recommended, preferably the latest LTS version.
> Consider using an IDE like [Visual Studio Code](https://code.visualstudio.com/) or [IntelliJ IDEA](https://www.jetbrains.com/idea/) to enhance your coding experience.
>
> ```bash theme={"theme":"css-variables"}
> # Install Node.js (if not already installed)
> # Visit https://nodejs.org/ or use package managers:
>
> # macOS (using Homebrew)
> brew install node
>
> # Ubuntu/Debian (using NodeSource)
> curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
> sudo apt-get install -y nodejs
>
> # Windows (using Chocolatey)
> choco install nodejs
>
> # Install the axios library
> npm install axios
> ```
>
> > [!TIP]
> >
> > If you need help setting up your environment, check out our detailed [Node.js scraping guide](https://www.zenrows.com/blog/web-scraping-javascript-nodejs)

> [tab] Java
>
> Java 8 or higher is recommended, preferably the latest LTS version, and a build tool like Maven or Gradle.
> IDEs like [IntelliJ IDEA](https://www.jetbrains.com/idea/) or [Eclipse](https://www.eclipse.org/) provide excellent Java development support.
>
> ```bash theme={"theme":"css-variables"}
> # Install Java (if not already installed)
> # Visit https://adoptium.net/ or use package managers:
>
> # macOS (using Homebrew)
> brew install openjdk
>
> # Ubuntu/Debian
> sudo apt update && sudo apt install openjdk-17-jdk
>
> # Windows (using Chocolatey)
> choco install openjdk
> ```
>
> For Maven projects, add this dependency to your `pom.xml`:
>
> ```xml xml theme={"theme":"css-variables"}
> <dependency>
>     <groupId>org.apache.httpcomponents.client5</groupId>
>     <artifactId>httpclient5-fluent</artifactId>
>     <version>5.2.1</version>
> </dependency>
> ```

> [tab] PHP
>
> PHP 7.4 or higher with cURL extension enabled is recommended, preferably the latest stable version.
> Consider editors like [PhpStorm](https://www.jetbrains.com/phpstorm/) or [Visual Studio Code](https://code.visualstudio.com/) with PHP extensions.
>
> ```bash theme={"theme":"css-variables"}
> # Install PHP (if not already installed)
> # Visit https://www.php.net/downloads or use package managers:
>
> # macOS (using Homebrew)
> brew install php
>
> # Ubuntu/Debian
> sudo apt update && sudo apt install php php-curl
>
> # Windows (using Chocolatey)
> choco install php
> ```
>
> PHP comes with cURL built-in, so no additional packages are needed for basic HTTP requests.

> [tab] Go
>
> Go 1.16 or higher is recommended, preferably the latest stable version.
> [Visual Studio Code](https://code.visualstudio.com/) with the Go extension or [GoLand](https://www.jetbrains.com/go/) provide excellent Go development environments.
>
> ```bash theme={"theme":"css-variables"}
> # Install Go (if not already installed)
> # Visit https://golang.org/dl/ or use package managers:
>
> # macOS (using Homebrew)
> brew install go
>
> # Ubuntu/Debian
> sudo apt update && sudo apt install golang-go
>
> # Windows (using Chocolatey)
> choco install golang
> ```
>
> Go's standard library includes the `net/http` package, so no additional dependencies are needed for HTTP requests.

> [tab] Ruby
>
> Ruby 2.7 or higher is recommended, preferably the latest stable version.
> Consider editors like [RubyMine](https://www.jetbrains.com/ruby/) or [Visual Studio Code](https://code.visualstudio.com/) with Ruby extensions.
>
> ```bash theme={"theme":"css-variables"}
> # Install Ruby (if not already installed)
> # Visit https://www.ruby-lang.org/en/downloads/ or use package managers:
>
> # macOS (using Homebrew)
> brew install ruby
>
> # Ubuntu/Debian
> sudo apt update && sudo apt install ruby-full
>
> # Windows (using Chocolatey)
> choco install ruby
>
> # Install the faraday gem
> gem install faraday
> ```

> [tab] cURL
>
> Typically pre-installed on most systems. If not available, install using your system's package manager.
>
> ```bash theme={"theme":"css-variables"}
> # cURL is typically pre-installed on most systems. If not, install it:
>
> # macOS (using Homebrew)
> brew install curl
>
> # Ubuntu/Debian
> sudo apt update && sudo apt install curl
>
> # Windows (using Chocolatey)
> choco install curl
> ```
>
> No additional packages needed - cURL works directly from the command line.

### Get Your API Key

Sign up for a free Zenrows account and get your API key from the Playground dashboard. You'll need this key to authenticate your requests.

[Sign up free](https://app.zenrows.com/register?prod=universal_scraper)
[Open the Playground](https://app.zenrows.com/fetch)

## 2. Make Your First Request

Start with a simple request to understand how Zenrows works. We'll use the [HTTPBin.io/get](https://httpbin.io/get) endpoint to demonstrate how Zenrows processes requests and returns data.

```python Python theme={"theme":"css-variables"}
# pip install requests
import requests

url = 'https://httpbin.io/get'
apikey = 'YOUR_ZENROWS_API_KEY'
params = {
    'url': url,
    'apikey': apikey,
    'mode': 'auto',
}

response = requests.get('https://api.zenrows.com/v1/', params=params)
print(response.text)
```

```javascript Node.js theme={"theme":"css-variables"}
// npm install axios
const axios = require('axios');

const url = 'https://httpbin.io/get';
const apikey = 'YOUR_ZENROWS_API_KEY';
axios({
    url: 'https://api.zenrows.com/v1/',
    method: 'GET',
    params: {
        'url': url,
        'apikey': apikey,
        'mode': 'auto',
    },
})
    .then(response => console.log(response.data))
    .catch(error => console.log(error));
```

```java Java theme={"theme":"css-variables"}
import org.apache.hc.client5.http.fluent.Request;

public class APIRequest {
    public static void main(final String... args) throws Exception {
        String apiUrl = "https://api.zenrows.com/v1/?apikey=YOUR_ZENROWS_API_KEY&url=https%3A%2F%2Fhttpbin.io%2Fget&mode=auto";
        String response = Request.get(apiUrl)
                .execute().returnContent().asString();

        System.out.println(response);
    }
}
```

```php PHP theme={"theme":"css-variables"}
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.zenrows.com/v1/?apikey=YOUR_ZENROWS_API_KEY&url=https%3A%2F%2Fhttpbin.io%2Fget&mode=auto');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 180);
$response = curl_exec($ch);
echo $response . PHP_EOL;
curl_close($ch);
?>
```

```go Go theme={"theme":"css-variables"}
package main

import (
    "io"
    "log"
    "net/http"
)

func main() {
    client := &http.Client{}
    req, err := http.NewRequest("GET", "https://api.zenrows.com/v1/?apikey=YOUR_ZENROWS_API_KEY&url=https%3A%2F%2Fhttpbin.io%2Fget&mode=auto", nil)
    if err != nil {
        log.Fatalln(err)
    }
    resp, err := client.Do(req)
    if err != nil {
        log.Fatalln(err)
    }
    defer resp.Body.Close()

    body, err := io.ReadAll(resp.Body)
    if err != nil {
        log.Fatalln(err)
    }

    log.Println(string(body))
}
```

```ruby Ruby theme={"theme":"css-variables"}
# gem install faraday
require 'faraday'

url = URI.parse('https://api.zenrows.com/v1/?apikey=YOUR_ZENROWS_API_KEY&url=https%3A%2F%2Fhttpbin.io%2Fget&mode=auto')
conn = Faraday.new()
conn.options.timeout = 180
res = conn.get(url, nil, nil)
print(res.body)
```

```bash cURL theme={"theme":"css-variables"}
curl --max-time 180 "https://api.zenrows.com/v1/?apikey=YOUR_ZENROWS_API_KEY&url=https%3A%2F%2Fhttpbin.io%2Fget&mode=auto"
```

Replace `YOUR_ZENROWS_API_KEY` with your actual API key and run the script:

```bash Python theme={"theme":"css-variables"}
python your_script.py
```

```bash Node.js theme={"theme":"css-variables"}
node your_script.js
```

```bash Java theme={"theme":"css-variables"}
javac YourScript.java && java YourScript
```

```bash PHP theme={"theme":"css-variables"}
php your_script.php
```

```bash Go theme={"theme":"css-variables"}
go run your_script.go
```

```bash Ruby theme={"theme":"css-variables"}
ruby your_script.rb
```

```bash cURL theme={"theme":"css-variables"}
# The cURL command runs directly in terminal
```

### Expected Output

The script will print the contents of the website, for `HTTPBin.io/get` it's something similar to this:

```json Response theme={"theme":"css-variables"}
{
    "args": {},
    "headers": {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36",
        // additional headers omitted for brevity...
    },
    "origin": "38.154.5.224:6693",
    "url": "http://httpbin.io/get"
}
```

Perfect! You've just made your first web scraping request with Zenrows.

## 3. Scrape More Complex Websites

Modern websites often use JavaScript to load content dynamically and employ sophisticated anti-bot protection. Zenrows provides powerful features to handle these challenges automatically.

### Use Adaptive Stealth Mode

The simplest way to scrape complex or protected sites in code is to use **Adaptive Stealth Mode** (`mode=auto`). Zenrows analyzes each request and automatically applies the right combination of JavaScript rendering and Premium Proxies only when needed, so you get reliable results without having to tune parameters yourself. Add `mode=auto` to your request:

```python Python theme={"theme":"css-variables"}
import requests

url = 'https://www.scrapingcourse.com/antibot-challenge'
apikey = 'YOUR_ZENROWS_API_KEY'

params = {
    'url': url,
    'apikey': apikey,
    'mode': 'auto',
}

response = requests.get('https://api.zenrows.com/v1/', params=params)
print(response.text)
```

```javascript Node.js theme={"theme":"css-variables"}
const axios = require('axios');

const url = 'https://www.scrapingcourse.com/antibot-challenge';
const apikey = 'YOUR_ZENROWS_API_KEY';

axios({
    url: 'https://api.zenrows.com/v1/',
    method: 'GET',
    params: {
        'url': url,
        'apikey': apikey,
        'mode': 'auto',
    },
})
    .then(response => console.log(response.data))
    .catch(error => console.log(error));
```

```java Java theme={"theme":"css-variables"}
import org.apache.hc.client5.http.fluent.Request;

public class APIRequest {
    public static void main(final String... args) throws Exception {
        String apiUrl = "https://api.zenrows.com/v1/?apikey=YOUR_ZENROWS_API_KEY&url=https%3A%2F%2Fwww.scrapingcourse.com%2Fantibot-challenge&mode=auto";
        String response = Request.get(apiUrl)
                .execute().returnContent().asString();

        System.out.println(response);
    }
}
```

```php PHP theme={"theme":"css-variables"}
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.zenrows.com/v1/?apikey=YOUR_ZENROWS_API_KEY&url=https%3A%2F%2Fwww.scrapingcourse.com%2Fantibot-challenge&mode=auto');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 180);
$response = curl_exec($ch);
echo $response . PHP_EOL;
curl_close($ch);
?>
```

```go Go theme={"theme":"css-variables"}
package main

import (
    "io"
    "log"
    "net/http"
)

func main() {
    client := &http.Client{}
    req, err := http.NewRequest("GET", "https://api.zenrows.com/v1/?apikey=YOUR_ZENROWS_API_KEY&url=https%3A%2F%2Fwww.scrapingcourse.com%2Fantibot-challenge&mode=auto", nil)
    if err != nil {
        log.Fatalln(err)
    }
    resp, err := client.Do(req)
    if err != nil {
        log.Fatalln(err)
    }
    defer resp.Body.Close()

    body, err := io.ReadAll(resp.Body)
    if err != nil {
        log.Fatalln(err)
    }

    log.Println(string(body))
}
```

```ruby Ruby theme={"theme":"css-variables"}
# gem install faraday
require 'faraday'

url = URI.parse('https://api.zenrows.com/v1/?apikey=YOUR_ZENROWS_API_KEY&url=https%3A%2F%2Fwww.scrapingcourse.com%2Fantibot-challenge&mode=auto')
conn = Faraday.new()
conn.options.timeout = 180
res = conn.get(url, nil, nil)
print(res.body)
```

```bash cURL theme={"theme":"css-variables"}
curl --max-time 180 "https://api.zenrows.com/v1/?apikey=YOUR_ZENROWS_API_KEY&url=https%3A%2F%2Fwww.scrapingcourse.com%2Fantibot-challenge&mode=auto"
```

**Optional parameters with Adaptive Stealth Mode:** When you use `mode=auto`, only the managed parameters (`js_render` and `premium_proxy`) are disabled to prevent conflicts. You can still use other API parameters alongside Adaptive Stealth Mode, such as:

* **Proxy country** (`proxy_country`): For region-restricted or geo-specific content, set the country of the IP (e.g., `proxy_country=us`). When a proxy country is set, Zenrows automatically applies Premium Proxies to test the most reliable configuration. If our system detects that another proxy type or country delivers better results for your request, we may switch it automatically to maximize success rates.
* **JavaScript rendering wait** (`wait` or `wait_for`): For slow-loading or dynamic content, add `wait` (milliseconds after page load) or `wait_for` (CSS selector). When a wait time is set, Zenrows automatically applies JavaScript rendering on the configuration.
* **Other parameters**: `css_extractor`, `session_id`, custom headers, and other API parameters remain available for use with `mode=auto`.

Example using optional parameters with Adaptive Stealth Mode:

```python Python theme={"theme":"css-variables"}
params = {
    'url': url,
    'apikey': apikey,
    'mode': 'auto',
    'proxy_country': 'us',  # Optional: specify proxy location
    'wait': '3000',         # Optional: wait 3 seconds when JS rendering is used
}
```

### Use the Request Playground (easy mode)

The Request Playground in your Zenrows dashboard offers an **easy mode** that uses Adaptive Stealth Mode by default. Enter your target URL and run a request. There's no need to choose JavaScript rendering or Premium Proxies yourself. Zenrows picks the proper configuration for each URL.

[Open the Playground](https://app.zenrows.com/fetch)

**Benefits:**

* Test any URL visually and see the result immediately
* Get a ready-to-use cURL command or code snippet with `mode=auto` included
* Reliable results on complex or protected sites without manual parameter tuning

Enter the target URL (for this demonstration, the [Anti-bot Challenge](https://www.scrapingcourse.com/antibot-challenge) page) in the **URL to Scrape** field and use easy mode to get started.

![Zenrows Request Playground Easy Mode](https://mintcdn.com/zenrows/bpr0c_CycI-XglbC/images/playground_easy_mode.png?fit=max\&auto=format\&n=bpr0c_CycI-XglbC\&q=85\&s=bb1af3336169ae6c54c78a792038eba6)

### Use the Request Playground (custom mode)

For fine-grained control when you know exactly which features a site needs, use the Request Playground's **custom mode** to set parameters yourself. You can manually configure JavaScript rendering, Premium Proxies, and other options, or select Adaptive Stealth Mode (`mode=auto`) to let Zenrows choose automatically.

![Zenrows Request Playground Custom Mode with Adaptive Stealth Mode](https://mintcdn.com/zenrows/bpr0c_CycI-XglbC/images/playground_custom_mode.png?fit=max\&auto=format\&n=bpr0c_CycI-XglbC\&q=85\&s=f2833bb37eae837ef0012d72f565c460)

### Custom headers in the Playground

The Fetch Playground sends custom headers to the target site without writing any code. Open the request settings (the sliders icon below the URL field) and click **Headers** in the **Request** row. Type the full header as `Name: value` in the single input field (for example, `Authorization: Bearer YOUR_TOKEN`), then click **Add** or press Enter. Repeat for each header you need.

> [!WARNING]
>
> Always type the header name, a colon, and a space before the value. If you type only the value, the Playground sends it as a `Referer` header.

Adding a header turns on `custom_headers=true` for you, and removing the last one turns it off. There's no separate toggle for it. What the generated snippets include depends on the tab:

* **API** tab: the cURL command and code snippets include your headers and `custom_headers=true`.
* **SDK** tab: the Python and Node.js snippets include your headers but leave out `custom_headers`, because the SDK sets it whenever you pass headers.
* **CLI** and **MCP** tabs: these show setup commands only and don't include your headers.

> [!NOTE]
>
> See [Custom Headers](https://docs.zenrows.com/fetch/features/headers.md) for which headers you can override (`Authorization`, `Referer`, `Cookie`, and most others) and which ones Zenrows always manages for you (like `User-Agent`).

### Use Premium Proxies

[Premium Proxies](https://docs.zenrows.com/fetch/features/premium-proxy.md) provide access to over 55 million residential IP addresses from 190+ countries with 99.9% uptime, ensuring the ability to bypass sophisticated anti-bot protection.

### Enable JavaScript Rendering

[JavaScript Rendering](https://docs.zenrows.com/fetch/features/js-rendering.md) uses a real browser to execute JavaScript and capture the fully rendered page. This is essential for modern web applications, single-page applications (SPAs), and sites that load content dynamically.

### Combine Features for Maximum Success

For the most protected sites, enable both **JavaScript Rendering** and **Premium Proxies**. This provides the highest success rate for challenging targets.

```python Python theme={"theme":"css-variables"}
import requests

url = 'https://www.scrapingcourse.com/antibot-challenge'
apikey = 'YOUR_ZENROWS_API_KEY'

params = {
    'url': url,
    'apikey': apikey,
    'js_render': 'true',
    'premium_proxy': 'true',
}

response = requests.get('https://api.zenrows.com/v1/', params=params)
print(response.text)
```

```javascript Node.js theme={"theme":"css-variables"}
const axios = require('axios');

const url = 'https://www.scrapingcourse.com/antibot-challenge';
const apikey = 'YOUR_ZENROWS_API_KEY';

axios({
    url: 'https://api.zenrows.com/v1/',
    method: 'GET',
    params: {
        'url': url,
        'apikey': apikey,
        'js_render': 'true',
        'premium_proxy': 'true',
    },
})
    .then(response => console.log(response.data))
    .catch(error => console.log(error));
```

```java Java theme={"theme":"css-variables"}
import org.apache.hc.client5.http.fluent.Request;

public class APIRequest {
    public static void main(final String... args) throws Exception {
        String apiUrl = "https://api.zenrows.com/v1/?apikey=YOUR_ZENROWS_API_KEY&url=https%3A%2F%2Fwww.scrapingcourse.com%2Fantibot-challenge&js_render=true&premium_proxy=true";
        String response = Request.get(apiUrl)
                .execute().returnContent().asString();

        System.out.println(response);
    }
}
```

```php PHP theme={"theme":"css-variables"}
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.zenrows.com/v1/?apikey=YOUR_ZENROWS_API_KEY&url=https%3A%2F%2Fwww.scrapingcourse.com%2Fantibot-challenge&js_render=true&premium_proxy=true');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 180);
$response = curl_exec($ch);
echo $response . PHP_EOL;
curl_close($ch);
?>
```

```go Go theme={"theme":"css-variables"}
package main

import (
    "io"
    "log"
    "net/http"
)

func main() {
    client := &http.Client{}
    req, err := http.NewRequest("GET", "https://api.zenrows.com/v1/?apikey=YOUR_ZENROWS_API_KEY&url=https%3A%2F%2Fwww.scrapingcourse.com%2Fantibot-challenge&js_render=true&premium_proxy=true", nil)
    if err != nil {
        log.Fatalln(err)
    }
    resp, err := client.Do(req)
    if err != nil {
        log.Fatalln(err)
    }
    defer resp.Body.Close()

    body, err := io.ReadAll(resp.Body)
    if err != nil {
        log.Fatalln(err)
    }

    log.Println(string(body))
}
```

```ruby Ruby theme={"theme":"css-variables"}
# gem install faraday
require 'faraday'

url = URI.parse('https://api.zenrows.com/v1/?apikey=YOUR_ZENROWS_API_KEY&url=https%3A%2F%2Fwww.scrapingcourse.com%2Fantibot-challenge&js_render=true&premium_proxy=true')
conn = Faraday.new()
conn.options.timeout = 180
res = conn.get(url, nil, nil)
print(res.body)
```

```bash cURL theme={"theme":"css-variables"}
curl --max-time 180 "https://api.zenrows.com/v1/?apikey=YOUR_ZENROWS_API_KEY&url=https%3A%2F%2Fwww.scrapingcourse.com%2Fantibot-challenge&js_render=true&premium_proxy=true"
```

This code sends a GET request to the Zenrows API endpoint with your target URL and authentication. The `js_render` parameter enables JavaScript processing, while `premium_proxy` routes your request through residential IP addresses.

#### Use-case recipes

Here are a few quick recipes you can adapt:

* **Form submission** → Use `js_render` + `js_instructions`.
* **Keep session across requests** → Add `session_id` to maintain session state and IP consistency.
* **Extract structured fields only** → Use `css_extractor` to return just the fields you need.

> [!NOTE]
>
> See the full [Common Use Cases & Recipes](https://docs.zenrows.com/fetch/common-use-cases.md) guide.

### Run Your Application

Execute your script to test the scraping functionality and verify that your setup works correctly.

```bash Python theme={"theme":"css-variables"}
python your_script.py
```

```bash Node.js theme={"theme":"css-variables"}
node your_script.js
```

```bash Java theme={"theme":"css-variables"}
javac YourScript.java && java YourScript
```

```bash PHP theme={"theme":"css-variables"}
php your_script.php
```

```bash Go theme={"theme":"css-variables"}
go run your_script.go
```

```bash Ruby theme={"theme":"css-variables"}
ruby your_script.rb
```

```bash cURL theme={"theme":"css-variables"}
# The cURL command runs directly in terminal
```

### Example Output

Run the script, and Zenrows will handle the heavy lifting by rendering the page's JavaScript and routing your request through premium residential proxies. The response will contain the entire HTML content of the page:

```html HTML theme={"theme":"css-variables"}
<html lang="en"><head>
    <title>Antibot Challenge - ScrapingCourse.com</title>
</head><body>
    <h2>You bypassed the Antibot challenge! :D</h2>
</body></html>
```

Congratulations! You now have a Zenrows integration that can scrape websites at any scale while bypassing anti-bot protection. You're ready to tackle more advanced scenarios and [customize the API](https://docs.zenrows.com/fetch/api-reference.md#parameter-overview) to fit your scraping needs.

## Troubleshooting

Request failures can happen for various reasons. While some issues can be resolved by adjusting Zenrows parameters, others are beyond your control, such as the target server being temporarily down.

Below are some quick troubleshooting steps you can take:

**1. Check the Error Code and Error Message**

When faced with an error, it's essential first to check the error code and message for indications of the error. The most common error codes are:

* **401 Unauthorized** \
  Your API key is missing, incorrect, or improperly formatted. Double-check that you are sending the correct API key in your request headers.

* **429 Too Many Requests** \
  You have exceeded your concurrency limit. Wait for ongoing requests to finish before sending new ones, or consider upgrading your plan for higher limits.

* **413 Content Too Large** \
  The response size exceeds your plan's limit. Use CSS selectors to extract only the needed data, reducing the response size.

* **422 Unprocessable Entity** \
  Your request contains invalid parameter values, or anti-bot protection is blocking access. Review the API documentation to ensure all parameters are correct and supported.

> [!TIP]
>
> Get more information on the [API Error Codes page](https://docs.zenrows.com/api-error-codes.md).

**2. Check if the Site is Publicly Accessible**

Some websites may require a session, so verifying if the site can be accessed without logging in is a good idea. Open the target page in an incognito browser to check this.

You must handle session management in your requests if authentication credentials are required. You can learn how to scrape a website that requires authentication in our guide: [Web scraping with Python](https://www.zenrows.com/blog/web-scraping-login-python).

**3. Verify the Site is Accessible in Your Country**

Sometimes, the target site may be region-restricted and only accessible to specific locations. Zenrows automatically selects the best proxy, but if the site is only available in concrete regions, specify a geolocation using `proxy_country`.

Here's how to choose a proxy in the US:

```python Python theme={"theme":"css-variables"}
params = {
    'premium_proxy': 'true',
    'proxy_country': 'us' # <- choose a premium proxy in the US
    # other configs...
}
response = requests.get('https://api.zenrows.com/v1/', params=params)

```

```javascript Node.js theme={"theme":"css-variables"}
params: {
    'premium_proxy': 'true',
    'proxy_country': 'us' // <- choose a premium proxy in the US
    // other configs...
},
```

If the target site requires access from a specific region, adding the `proxy_country` parameter will help.

> [!TIP]
>
> Check out more about it on our [Geolocation Documentation Page](https://docs.zenrows.com/fetch/features/proxy-country.md).

**4. Add Pauses to Your Request**

You can also enhance your request by adding options like `wait` or `wait_for` to ensure the page fully loads before extracting data, improving accuracy.

```python Python theme={"theme":"css-variables"}
# Use a wait parameter or a wait_for parameter
params = {
    'wait': '3000', # <- Adds a delay of 3 seconds
    # other configs...
}
response = requests.get('https://api.zenrows.com/v1/', params=params)

```

```javascript Node.js theme={"theme":"css-variables"}
params: {
    'wait': '3000', // <- Adds a delay of 3 seconds
    // other configs...
},
```

> [!TIP]
>
> Find more details on our [Wait Documentation](https://docs.zenrows.com/fetch/features/wait.md) on [Wait For Selector Documentation](https://docs.zenrows.com/fetch/features/wait-for.md).

**5. Retry the Request**

Network issues or temporary failures can cause your request to fail. Implementing retry logic can solve this by automatically repeating the request.

```python Python theme={"theme":"css-variables"}
import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry

# Define the retry strategy
retry_strategy = Retry(
    total=4,  # Maximum number of retries
    status_forcelist=[429, 500, 502, 503, 504],  # HTTP status codes to retry on
)
# Create an HTTP adapter with the retry strategy and mount it to session
adapter = HTTPAdapter(max_retries=retry_strategy)

# Create a new session object
session = requests.Session()
session.mount('http://', adapter)
session.mount('https://', adapter)

# Make a request using the session object
response = session.get('https://scrapingcourse.com/ecommerce/')

if response.status_code == 200:
    print(f'SUCCESS: {response.text}')
else:
    print("FAILED")
```

```javascript Node.js theme={"theme":"css-variables"}
// npm install axios-retry
import axiosRetry from 'axios-retry';
import axios from 'axios';

// Pass the axios instance to the retry function and call it
axiosRetry(axios, {
    retries: 3, // Number of retries (Defaults to 3)
});

// Make Axios requests below
axios.get('https://scrapingcourse.com/ecommerce/') // The request is retried if it fails
    .then((response) => {
        console.log('Data: ', response.data);
    }).catch((error) => {
        console.log('Error: ', error);
    });
```

> [!TIP]
>
> You can learn more on our [Python requests retry guide](https://www.zenrows.com/blog/python-requests-retry) and [Node.js Axios retry guide](https://www.zenrows.com/blog/axios-retry).

**6. Get Help From Zenrows Experts**

Our support team can assist you if the issue persists despite following these tips. Use the Playground page or [contact us via email](mailto:success@zenrows.com) to get personalized help from Zenrows experts.

[Open the Playground](https://app.zenrows.com/fetch)

![Zenrows Request Playground Page](https://mintcdn.com/zenrows/bpr0c_CycI-XglbC/images/request_playground.png?fit=max\&auto=format\&n=bpr0c_CycI-XglbC\&q=85\&s=cbfeabccbfeaafb4c4a84c35664b2a3f)

> [!TIP]
>
> For more solutions and detailed troubleshooting steps, see our [Troubleshooting Guides](https://docs.zenrows.com/fetch/troubleshooting/troubleshooting-guide.md).

## Next Steps

You now have a solid foundation for web scraping with Zenrows. Here are some recommended next steps to take your scraping to the next level:

* **[Complete API Reference](https://docs.zenrows.com/fetch/api-reference.md)**: \
  Explore all available parameters and advanced configuration options to customize Zenrows for your specific use cases.
* **[JavaScript Instructions Guide](https://docs.zenrows.com/fetch/features/js-instructions.md)**: \
  Learn how to perform complex page interactions like form submissions, infinite scrolling, and multi-step workflows.
* **[Output Formats and Data Extraction](https://docs.zenrows.com/fetch/features/markdown.md)**: \
  Learn advanced data extraction with CSS selectors, output formats including Markdown and PDF conversion, and screenshot configurations.
* **[Pricing and Plans](https://docs.zenrows.com/first-steps/pricing.md)**: \
  Understand how request costs are calculated and choose the plan that best fits your scraping volume and requirements.

## Frequently Asked Questions (FAQ)

> [accordion] How can I bypass CloudFlare and other protections?
>
> To reliably access sites behind CloudFlare or similar security mechanisms, enable both `js_render` and `premium_proxy` in your requests. These features simulate a full browser environment and route through high-quality residential proxies for protected access.
> You can also enhance your request by adding options like `wait` or `wait_for` to ensure the page fully loads before extracting data, improving accuracy.
>
> > [!TIP]
> >
> > Check out our documentation about the [wait](https://docs.zenrows.com/fetch/features/wait.md) and [wait\_for](https://docs.zenrows.com/fetch/features/wait-for.md) params.

> [accordion] How can I ensure my requests don't fail?
>
> You can configure retry logic to handle failed HTTP requests. Learn more in our [guide on retrying requests](https://docs.zenrows.com/academy/retry-failed-requests.md).

> [accordion] How do I extract specific content from a page?
>
> You can use the `css_extractor` parameter to directly extract content from a page using CSS selectors. Find out more in our [tutorial on data parsing](https://docs.zenrows.com/academy/how-to-extract-data.md).

> [accordion] Can I integrate Zenrows with Python's Requests and BeautifulSoup?
>
> Yes! You can use Zenrows alongside Python Requests and BeautifulSoup for HTML parsing. Learn how in our guide on [Python Requests and BeautifulSoup integration](https://docs.zenrows.com/academy/how-to-extract-data.md#python-with-beautifulsoup).

> [accordion] Can I integrate Zenrows with Node.js and Cheerio?
>
> Yes! You can integrate Zenrows with Node.js and Cheerio for efficient HTML parsing and web scraping. Check out our guide to learn how to combine these tools: [Node.js and Cheerio integration](https://docs.zenrows.com/academy/how-to-extract-data.md#javascript-with-cheerio).

> [accordion] How can I simulate user interactions on the target page?
>
> Use the `js_render` and `js_instructions` features to simulate actions such as clicking buttons or filling out forms. Discover more about interacting with web pages in our [JavaScript instructions guide](https://docs.zenrows.com/fetch/features/js-instructions.md).

> [accordion] How can I scrape faster using Zenrows?
>
> You can scrape multiple URLs simultaneously by making concurrent API calls. Check out our guide on [using concurrency](https://docs.zenrows.com/fetch/features/concurrency.md#using-concurrency) to boost your scraping speed.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.