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

> ## Agent Instructions
> Anchor Browser is cloud browser infrastructure for AI agents and automation: browser sessions you control over CDP or REST, natural-language web tasks, versioned automation tasks, managed authentication into third-party web apps (identities with MFA), persistent volumes and profiles, recordings, live view, batch sessions, webhooks, and network options including residential proxies, extra stealth, and captcha solving for sites that block standard browsers. AI agents should start at https://docs.anchorbrowser.io/for-agents, then get an API key with Agent Access at https://docs.anchorbrowser.io/quickstart/agent-access — no dashboard account required. Read those two pages before authentication or API calls.

# Proxy

Anchor provides proxy configurations to access websites from different geographic locations, configurable down to the **city level.** Use [Bring Your Own Proxy](/advanced/bring-your-own-proxy) or Anchor's built-in proxy for localization.

<Warning>
  Anchor Browser infrastructure is fully hosted in the US. For GDPR compliance, upgrade to the [Growth tier](https://app.anchorbrowser.io/billing) or [contact support](https://mail.google.com/mail/?view=cm\&fs=1\&to=support@anchorbrowser.io\&su=Full%20GDPR%20Compatibility%20Request).
</Warning>

#### Quick Start Example

Here's a simple example of how to use Anchor's built-in proxy:

<CodeGroup>
  ```javascript node.js theme={null}
  import { client, Sessions } from 'anchorbrowser';

  client.setConfig({ auth: () => process.env.ANCHOR_API_KEY });

  const session = await Sessions.createSession({
    body: {
      session: {
        proxy: {
          active: true,
          country_code: 'gb',
        }
      }
    }
  });

  console.log("Session created:", session.data);
  ```

  ```python python theme={null}
  import os
  from anchorbrowser import Anchorbrowser

  anchor_client = Anchorbrowser(api_key=os.getenv("ANCHOR_API_KEY"))

  session = anchor_client.sessions.create_session(
    session={
      'proxy': {
          'active': True,
          'country_code': 'gb',
      }
    }
  )
  print("Session created:", session.data)
  ```
</CodeGroup>

This creates a browser session using Anchor's built-in proxy. You can change `country_code` to any supported country (e.g., 'gb', 'de', 'jp').

To experiment with different proxy configurations, visit our [Interactive API Reference](/api-reference/browser-sessions/start-browser-session)

## Using proxy with tasks

Save proxy settings on the task via `task_default_browser_configuration` — a **one-time setup**. Every run that does not pass a `session_id` will use this config.

Set it with `PATCH /v1/tools/{toolId}` or `task_browser_default_configuration` on `POST /v2/tasks/generate`:

```bash theme={null}
curl -X PATCH "https://api.anchorbrowser.io/v1/tools/{toolId}" \
  -H "anchor-api-key: $ANCHOR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "task_default_browser_configuration": {
      "session": {
        "proxy": {
          "active": true,
          "type": "anchor_residential",
          "country_code": "us"
        }
      },
      "browser": {
        "captcha_solver": { "active": true },
        "profile": { "name": "my-task-profile", "persist": true }
      }
    }
  }'
```

<Note>
  If you create a session with `POST /v1/sessions` and pass its `session_id` to `/run`, **that session's config is used** — including proxy. The task's `task_default_browser_configuration` is ignored for that run.
</Note>

See [Run a Task](/tasks/run-a-task#task-config-vs-session-config) for the full run flow.

## Localization

You can specify a country code for your proxy to route traffic through a specific geographic location. This is useful for accessing region-specific content or testing localized experiences.

The `country_code` parameter accepts country codes in lowercase. See the [complete list of supported countries](#supported-countries-with-their-country-codes) below for all available options.

### Region and City-Based Targeting

For even more precise geographic targeting, you can specify both `region` and `city` parameters. This is only supported for the default proxy type (`anchor_proxy`).

**Important Notes:**

* The `city` parameter can only be used when `region` is also provided
* If you specify a city without a region, the city parameter will be ignored
* City names: use English, case-insensitive. Both "Los Angeles" and "los-angeles" work.

<CodeGroup>
  ```javascript node.js theme={null}
  import { client, Sessions } from 'anchorbrowser';

  client.setConfig({ auth: () => process.env.ANCHOR_API_KEY });

  const response = await Sessions.createSession({
    body: {
      session: {
        proxy: {
          active: true,
          country_code: 'us',
          region: 'ca',
          city: 'los-angeles'
        }
      }
    }
  });
    
  console.log('Session created:', response.data);
  ```

  ```python python theme={null}
  import os
  import json
  from anchorbrowser import Anchorbrowser

  anchor_client = Anchorbrowser(api_key=os.getenv('ANCHOR_API_KEY'))

  response = anchor_client.sessions.create_session(
      session={
          'proxy': {
              'active': True,
              'country_code': 'us',
              'region': 'ca',
              'city': 'los-angeles'
          }
      }
  )

  print('Session created:')
  print(response.data)
  ```
</CodeGroup>

### Supported Countries with their Country Codes

<Tabs>
  <Tab title="Anchor Proxy">
    | | | | | | |
    | - | - | - | - | - | - |
    | Afghanistan | af | France | fr | Netherlands | nl |
    | Albania | al | French Guiana | gf | New Zealand | nz |
    | Algeria | dz | French Polynesia | pf | Nicaragua | ni |
    | Andorra | ad | Gabon | ga | Nigeria | ng |
    | Angola | ao | Gambia | gm | Norway | no |
    | American Samoa | as | Georgia | ge | Pakistan | pk |
    | Antigua and Barbuda | ag | Germany | de | Panama | pa |
    | Argentina | ar | Ghana | gh | Paraguay | py |
    | Armenia | am | Gibraltar | gi | Peru | pe |
    | Aruba | aw | Greece | gr | Philippines | ph |
    | Australia | au | Grenada | gd | Poland | pl |
    | Austria | at | Guadeloupe | gp | Portugal | pt |
    | Azerbaijan | az | Guatemala | gt | Puerto Rico | pr |
    | Bahamas | bs | Guernsey | gg | Qatar | qa |
    | Bahrain | bh | Guinea | gn | Romania | ro |
    | Barbados | bb | Guinea-Bissau | gw | Saint Lucia | lc |
    | Belarus | by | Guyana | gy | San Marino | sm |
    | Belgium | be | Haiti | ht | Saudi Arabia | sa |
    | Belize | bz | Honduras | hn | Senegal | sn |
    | Benin | bj | Hungary | hu | Serbia | rs |
    | Bermuda | bm | Iceland | is | Seychelles | sc |
    | Bolivia | bo | India | in | Sierra Leone | sl |
    | Bosnia and Herzegovina | ba | Iran | ir | Slovakia | sk |
    | Brazil | br | Iraq | iq | Slovenia | si |
    | Bulgaria | bg | Ireland | ie | Somalia | so |
    | Burkina Faso | bf | Israel | il | South Africa | za |
    | Cameroon | cm | Italy | it | South Korea | kr |
    | Canada | ca | Jamaica | jm | Spain | es |
    | Cape Verde | cv | Japan | jp | Suriname | sr |
    | Chad | td | Jordan | jo | Sweden | se |
    | Chile | cl | Kazakhstan | kz | Switzerland | ch |
    | Colombia | co | Kuwait | kw | Syria | sy |
    | Congo | cg | Kyrgyzstan | kg | São Tomé and Príncipe | st |
    | Costa Rica | cr | Latvia | lv | Taiwan | tw |
    | Côte d’Ivoire | ci | Lebanon | lb | Tajikistan | tj |
    | Croatia | hr | Libya | ly | Togo | tg |
    | Cuba | cu | Liechtenstein | li | Trinidad and Tobago | tt |
    | Cyprus | cy | Lithuania | lt | Tunisia | tn |
    | Czech Republic | cz | Luxembourg | lu | Turkey | tr |
    | Denmark | dk | Macedonia | mk | Turks and Caicos Islands | tc |
    | Dominica | dm | Mali | ml | Ukraine | ua |
    | Dominican Republic | do | Malta | mt | United Arab Emirates | ae |
    | Ecuador | ec | Martinique | mq | United Kingdom | gb |
    | Egypt | eg | Mauritania | mr | United States | us |
    | El Salvador | sv | Mexico | mx | Uruguay | uy |
    | Estonia | ee | Moldova | md | Uzbekistan | uz |
    | Ethiopia | et | Monaco | mc | Venezuela | ve |
    | Faroe Islands | fo | Montenegro | me | Yemen | ye |
    | Finland | fi | Morocco | ma | | |
  </Tab>
</Tabs>


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