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

# Country Targeting for the Zenrows Browser

> Learn how to configure country-level geo-targeting in the Zenrows Browser to access localized content and geo-restricted websites.

The Zenrows Browser (formerly, Scraping Browser) enables precise country-level targeting for your web scraping operations, letting you access content as if you were browsing from a specific country. This is essential for geo-restricted content, localized pricing, and market research across nations.

## What is Country Targeting?

Country-targeting routes your scraping requests through residential IP addresses from a specific country, providing the most precise geolocation control available. Unlike world region targeting, which covers broad areas, country targeting gives you IPs from individual nations.

**Key benefits:**

* Access country-specific content and services
* Accurate localized pricing and product data
* Compliance testing for legal jurisdictions
* Ad verification and fraud prevention by country
* Market research with country-level precision

> [!NOTE]
>
> Auto-rotate and Residential IPs are pre-configured and enabled by default for all Zenrows Browser users. Country targeting works seamlessly with these features to provide optimal performance.

## How to Configure Country Targeting

You can configure country targeting in two ways:

* **Zenrows SDK:** Recommended for most users (simplest, most robust)
* **Direct WebSocket URL:** For advanced or custom integrations

> [tab] Puppeteer
>
> For custom integrations or direct control, specify the country using the `proxy_country` parameter in the WebSocket URL.
>
> ```bash theme={"theme":"css-variables"}
> wss://browser.zenrows.com?apikey=YOUR_ZENROWS_API_KEY&proxy_country=es
> ```
>
> ```javascript Node.js theme={"theme":"css-variables"}
> const puppeteer = require('puppeteer-core');
> const wsUrl = 'wss://browser.zenrows.com?apikey=YOUR_ZENROWS_API_KEY&proxy_country=es';
>
> (async () => {
>     const browser = await puppeteer.connect({ browserWSEndpoint: wsUrl });
>     const page = await browser.newPage();
>     await page.goto('https://example.com');
>     console.log(await page.title());
>     await browser.close();
> })();
> ```
>
> ```python Python theme={"theme":"css-variables"}
> import asyncio
> from pyppeteer import connect
>
> async def main():
>     ws_url = 'wss://browser.zenrows.com?apikey=YOUR_ZENROWS_API_KEY&proxy_country=es'
>     browser = await connect(browserWSEndpoint=ws_url)
>     page = await browser.newPage()
>     await page.goto('https://example.com')
>     print(await page.title())
>     await browser.close()
>
> asyncio.get_event_loop().run_until_complete(main())
> ```
>
> Zenrows supports residential IPs from over 100 countries worldwide. For the complete list and codes, see our [Premium Proxy Countries List](https://docs.zenrows.com/first-steps/faq.md#what-is-geolocation-and-what-are-all-the-premium-proxy-countries).
>
> **Most Popular:**
>
> * **us** - United States
> * **gb** - United Kingdom
> * **br** - Brazil
> * **de** - Germany
> * **ca** - Canada
> * **au** - Australia
> * **fr** - France
> * **in** - India
> * **es** - Spain
> * **it** - Italy
> * **nl** - Netherlands

> [tab] Playwright
>
> For custom integrations or direct control, specify the country using the `proxy_country` parameter in the WebSocket URL.
>
> ```bash theme={"theme":"css-variables"}
> wss://browser.zenrows.com?apikey=YOUR_ZENROWS_API_KEY&proxy_country=es
> ```
>
> ```javascript Node.js theme={"theme":"css-variables"}
> const { ScrapingBrowser, ProxyCountry } = require('@zenrows/scraping-browser');
> const { chromium } = require('playwright');
>
> (async () => {
>     const scrapingBrowser = new ScrapingBrowser({ apiKey: 'YOUR_ZENROWS_API_KEY' });
>     // Target Germany
>     const connectionURL = scrapingBrowser.getConnectURL({
>         proxy: { location: ProxyCountry.DE },
>     });
>     const browser = await chromium.connectOverCDP(connectionURL);
>     const page = await browser.newPage();
>     await page.goto('https://example.com');
>     console.log(await page.title());
>     await browser.close();
> })();
> ```
>
> ```python Python theme={"theme":"css-variables"}
> import asyncio
> from playwright.async_api import async_playwright
>
> async def main():
>     ws_url = 'wss://browser.zenrows.com?apikey=YOUR_ZENROWS_API_KEY&proxy_country=es'
>     async with async_playwright() as p:
>         browser = await p.chromium.connect_over_cdp(ws_url)
>         page = await browser.new_page()
>         await page.goto('https://example.com')
>         print(await page.title())
>         await browser.close()
>
> asyncio.run(main())
> ```
>
> Zenrows supports residential IPs from over 100 countries worldwide. For the complete list and codes, see our [Premium Proxy Countries List](https://docs.zenrows.com/first-steps/faq.md#what-is-geolocation-and-what-are-all-the-premium-proxy-countries).
>
> **Most Popular:**
>
> * **us** - United States
> * **gb** - United Kingdom
> * **br** - Brazil
> * **de** - Germany
> * **ca** - Canada
> * **au** - Australia
> * **fr** - France
> * **in** - India
> * **es** - Spain
> * **it** - Italy
> * **nl** - Netherlands

> [tab] Zenrows SDK
>
> The Zenrows SDK offers the easiest way to configure country targeting, with built-in error handling and connection management.
>
> ```javascript Node.js Puppeteer theme={"theme":"css-variables"}
> const { ScrapingBrowser, ProxyCountry } = require('@zenrows/scraping-browser');
> const puppeteer = require('puppeteer-core');
>
> (async () => {
>     const scrapingBrowser = new ScrapingBrowser({ apiKey: 'YOUR_ZENROWS_API_KEY' });
>     // Target Spain
>     const connectionURL = scrapingBrowser.getConnectURL({
>         proxy: { location: ProxyCountry.ES },
>     });
>     const browser = await puppeteer.connect({ browserWSEndpoint: connectionURL });
>     const page = await browser.newPage();
>     await page.goto('https://example.com');
>     console.log(await page.title());
>     await browser.close();
> })();
> ```
>
> ```javascript Node.js Playwright theme={"theme":"css-variables"}
> const { ScrapingBrowser, ProxyCountry } = require('@zenrows/scraping-browser');
> const { chromium } = require('playwright');
>
> (async () => {
>     const scrapingBrowser = new ScrapingBrowser({ apiKey: 'YOUR_ZENROWS_API_KEY' });
>     // Target Germany
>     const connectionURL = scrapingBrowser.getConnectURL({
>         proxy: { location: ProxyCountry.DE },
>     });
>     const browser = await chromium.connectOverCDP(connectionURL);
>     const page = await browser.newPage();
>     await page.goto('https://example.com');
>     console.log(await page.title());
>     await browser.close();
> })();
> ```
>
> **Popular SDK Country Options:**
>
> * `ProxyCountry.US` - United States
> * `ProxyCountry.GB` - United Kingdom
> * `ProxyCountry.BR` - Brazil
> * `ProxyCountry.DE` - Germany
> * `ProxyCountry.FR` - France
> * `ProxyCountry.IN` - India
> * `ProxyCountry.ES` - Spain
> * `ProxyCountry.CA` - Canada
> * `ProxyCountry.AU` - Australia
> * `ProxyCountry.JP` - Japan

![Country Targeting Configuration Interface](https://mintcdn.com/zenrows/bpr0c_CycI-XglbC/images/browser_proxy_country.png?fit=max\&auto=format\&n=bpr0c_CycI-XglbC\&q=85\&s=d0c0774bb15d000415b82d694977aa6d)

## Best Practices

**Choosing the Right Country:**

* Select countries based on your target market or content
* Consider local business hours and time zones for time-sensitive scraping
* Test with multiple countries to understand regional content differences

**SDK vs Direct Connection:**

* **Use the SDK** for most projects. It offers better error handling and automatic retries
* **Direct WebSocket** is for custom frameworks or specific connection control

**Performance Optimization:**

* Some countries have larger IP pools and better performance
* Monitor success rates and adjust the country selection accordingly
* Use fallback countries if your primary choice has issues

## Troubleshooting

**Common Issues and Solutions:**

**Country Code Errors:**

* Use the correct ISO country code (e.g., 'es' for Spain)
* Check the country list to ensure support
* Use lowercase codes in direct WebSocket connections

**No Content Differences:**

* Some sites may not vary by country. Test manually by accessing the website
* Try different countries to verify geo-targeting
* Some sites use detection beyond IP geolocation

**Connection Issues:**

* Some countries may have smaller IP pools. Try alternative countries
* Monitor the response error for indications that may help
* Use world region targeting if country-level access is problematic

> [!TIP]
>
> You cannot use both world region and country targeting at the same time. Select the level of precision you require, whether broad regional coverage or targeted to a specific country.

## Next Steps

* Explore [Session TTL Configuration](https://docs.zenrows.com/browser-sessions/features/session-ttl.md) to control browser session duration
* Learn about [World Region Targeting](https://docs.zenrows.com/browser-sessions/features/world-region.md) for broader coverage
* See the [Zenrows SDK Repository](https://github.com/ZenRows/browser-js-sdk) for advanced features and examples
* Review [Premium Proxy Countries List](https://docs.zenrows.com/first-steps/faq.md#what-is-geolocation-and-what-are-all-the-premium-proxy-countries) for all available countries
* Check the [Practical Use Cases](https://docs.zenrows.com/browser-sessions/help/practical-use-cases.md) for real world examples


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