> ## 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.

# Adaptive Stealth Mode

> ZenRows intelligent scraping mode that automatically selects optimal configurations while minimizing costs and maintenance overhead.

Adaptive Stealth Mode is ZenRows' automated execution mode that analyzes each request and selects the most cost-effective configuration needed for successful data extraction. Instead of manually configuring parameters, Adaptive Stealth Mode starts with basic settings and escalates only when necessary, eliminating ongoing maintenance as websites change their protection mechanisms.

**When you enable Adaptive Stealth Mode, ZenRows:**

* **Prioritizes successful extraction** above all else
* **Starts with the cheapest viable configuration** for each request
* **Automatically escalates** to more powerful features only when necessary
* **Bills only for the configuration that succeeds** - failed attempts incur no charges
* **Adapts automatically** as website behavior changes over time
* **Reduces maintenance overhead** by eliminating the need to monitor and update scraping configurations

Adaptive Stealth Mode eliminates the need for manual parameter tuning in production environments.

## How Adaptive Stealth Mode Works

Adaptive Stealth Mode executes each request using a progressive strategy:

1. **Target Analysis:** Evaluates the target URL using known patterns and runtime signals to predict the best starting configuration.

2. **Lowest-Cost Attempt:** Executes the request with the least expensive configuration likely to succeed based on the analysis.

3. **Automatic Escalation:** Retries with stronger features if the initial attempt fails, progressively adding capabilities as needed.

4. **Success-Only Billing:** You are billed only for the configuration that completes successfully. Failed attempts incur no charges.

This approach ensures reliable data extraction without overpaying for unnecessary features.

## Basic Usage

### API Usage

Add `mode=auto` to your request:

<CodeGroup>
  ```python Python theme={null}
  # pip install requests
  import requests

  url = 'https://www.scrapingcourse.com/ecommerce/'
  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={null}
  // npm install axios
  const axios = require('axios');

  const url = 'https://www.scrapingcourse.com/ecommerce/';
  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={null}
  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%2Fecommerce%2F&mode=auto";
          String response = Request.get(apiUrl)
                  .execute().returnContent().asString();
          System.out.println(response);
      }
  }
  ```

  ```php PHP theme={null}
  <?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%2Fecommerce%2F&mode=auto');
  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  $response = curl_exec($ch);
  echo $response . PHP_EOL;
  curl_close($ch);
  ?>
  ```

  ```go Go theme={null}
  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%2Fecommerce%2F&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={null}
  # 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%2Fecommerce%2F&mode=auto')
  conn = Faraday.new()
  conn.options.timeout = 180
  res = conn.get(url, nil, nil)
  print(res.body)
  ```

  ```bash cURL theme={null}
  curl "https://api.zenrows.com/v1/?url=https://www.scrapingcourse.com/ecommerce/&apikey=YOUR_ZENROWS_API_KEY&mode=auto"
  ```
</CodeGroup>

## When to Use Adaptive Stealth Mode

**Recommended when:**

* Scraping multiple websites with different behaviors
* Website requirements are unknown or change frequently
* Reliability matters more than manual optimization
* You're running production workloads at scale
* You want to minimize maintenance overhead from website changes

**Consider manual configuration for:**

* Single, stable domains where you know the optimal setup
* Scenarios requiring predictable, consistent feature usage
* Cost-sensitive applications with well-understood requirements

## Managed Parameters

Adaptive Stealth Mode automatically manages these API parameters:

| Parameter       | Purpose                                  | When Applied                                            |
| --------------- | ---------------------------------------- | ------------------------------------------------------- |
| `js_render`     | JavaScript rendering for dynamic content | Sites using React, Vue, Angular, or AJAX loading        |
| `premium_proxy` | Residential IP addresses                 | Sites blocking datacenter IPs or requiring geo-location |

<Warning>
  The managed parameters above are disabled when using Adaptive Stealth Mode to prevent conflicting configurations. Other parameters remain available for use.

  If you set the parameters manually, Adaptive Stealth Mode will return a 400 error:

  ```json theme={null}
  {
    "code": "REQ_INVALID_PARAMS",
    "message": "js_render and premium_proxy parameters cannot be used with automatic mode"
  }
  ```
</Warning>

## Adaptive Stealth Mode vs Manual Configuration

| Aspect                     | Adaptive Stealth Mode (`mode=auto`) | Manual Parameters          |
| -------------------------- | ----------------------------------- | -------------------------- |
| Setup time                 | Single parameter                    | Requires tuning            |
| Success optimization       | Automatic                           | User-managed               |
| Cost optimization          | Automatic, per request              | Fixed by chosen config     |
| Adaptation to site changes | Automatic                           | Requires updates           |
| Failed attempts billed     | No                                  | No                         |
| Best for                   | Production, multi-domain workloads  | Stable, well-known targets |

## Troubleshooting

### Common Issues

**Adaptive Stealth Mode not working as expected**

* Verify the `mode=auto` parameter is correctly set
* Check that other conflicting parameters aren't overriding Adaptive Stealth Mode
* Review the response headers for cost and feature information

**Higher costs than expected**

* Monitor the `X-Request-Cost` header to understand feature usage
* Consider manual configuration if cost patterns are predictable
* Use the Playground UI to preview costs before running requests

**Inconsistent results**

* Adaptive Stealth Mode adapts to website changes, which may affect feature selection
* Use `session_id` to maintain consistency across related requests
* Switch to manual configuration for completely predictable behavior

## Pricing

Adaptive Stealth Mode uses transparent, usage-based pricing with these cost multipliers:

| Configuration        | Cost Multiplier | When Used                                            |
| -------------------- | --------------- | ---------------------------------------------------- |
| Basic request        | 1x              | Simple static websites                               |
| JavaScript rendering | 5x              | Dynamic content requiring browser processing         |
| Premium Proxies      | 10x             | Sites blocking datacenter IPs                        |
| Combined features    | 25x             | Highly protected sites requiring both JS and proxies |

<Info>You are billed only once, for the configuration that succeeds. If Adaptive Stealth Mode requires multiple internal attempts before success, ZenRows bills only for the successful configuration.</Info>

<Tip>
  You can monitor your ZenRows usage in multiple ways to stay informed about your account activity and prevent unexpected overages.

  **Dashboard monitoring**: View real-time usage statistics, remaining requests, success rates, and request history on your [Analytics Page](https://app.zenrows.com/analytics/scraper-api). You can also set up usage alerts in your [notification settings](https://app.zenrows.com/account/notifications) to receive notifications when you approach your limits.

  **Programmatic monitoring**: For automated monitoring in your applications, call the `/v1/subscriptions/self/details` endpoint with your API key in the `X-API-Key` header. This returns real-time usage data that you can integrate into your monitoring systems. [Learn more about the usage endpoint](https://docs.zenrows.com/universal-scraper-api/features/other#plan-usage).

  **Response header monitoring**: Track your concurrency usage through response headers included with each request:

  * `Concurrency-Limit`: Your maximum concurrent requests
  * `Concurrency-Remaining`: Available concurrent request slots
  * `X-Request-Cost`: Cost of the current request
</Tip>

## Frequently Asked Questions (FAQ)

<Accordion title="Will Adaptive Stealth Mode increase my costs?">
  No. Adaptive Stealth Mode minimizes costs by avoiding unnecessary features and charging only for successful requests. It often reduces costs compared to manually over-configuring parameters.
</Accordion>

<Accordion title="How much visibility do I have into Adaptive Stealth Mode decisions?">
  You retain full visibility through response headers (including request cost) and the <a href="https://app.zenrows.com/analytics/scraper-api" target="_blank">Analytics</a> dashboard, without needing to manage configuration decisions manually.
</Accordion>

<Accordion title="What happens if a website changes its anti-bot measures?">
  Adaptive Stealth Mode adapts automatically without requiring parameter updates on your end. The system learns from new blocking patterns and adjusts accordingly.
</Accordion>

<Accordion title="Can I use Adaptive Stealth Mode with other parameters?">
  Yes, but with limitations. 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 like `css_extractor`, `session_id`, or custom request settings alongside Adaptive Stealth Mode.
</Accordion>
