Anchor provides proxy configurations to help you access websites from different geographic locations. You can use custom proxies or leverage Anchor’s built-in proxy infrastructure for localization.

Quick Start Example

Here’s a simple example of how to use Anchor’s built-in proxy:
import AnchorBrowser from 'anchorbrowser';

(async () => {
  const anchor_client = new AnchorBrowser({apiKey: process.env.ANCHOR_API_KEY});
  
  const session = await anchor_client.sessions.create({
    session: {
      proxy: {
        active: true,
        country_code: 'us',
        type: 'anchor_residential
      }
    }
  });
  
  console.log("Session created:", session.data);
})().catch(console.error);
This creates a browser session using Anchor’s US 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

Custom Proxy

Anchor Browser allows you to use your own proxy servers, giving you complete control over your proxy infrastructure. This is particularly useful when you have existing proxy solutions or need to comply with specific network policies.

Custom Proxy Configuration

To use a custom proxy, you need to provide the following information:
  • type: Set to "custom" to indicate you’re using your own proxy
  • server: The hostname or IP address of your proxy server
  • port: The port number your proxy server listens on (optional, defaults to 80 for HTTP, 443 for HTTPS)
  • username: Your proxy authentication username (if required)
  • password: Your proxy authentication password (if required)
  • active: Set to true to enable the proxy

Supported Proxy Protocols

Anchor Browser supports the following proxy protocols:
  • HTTP Proxy: Standard HTTP proxy with optional authentication
  • HTTPS Proxy: Secure HTTPS proxy connections
  • SOCKS5 Proxy: SOCKS5 proxy for enhanced privacy and flexibility

Example Configurations

import AnchorBrowser from 'anchorbrowser';

(async () => {
  const anchor_client = new AnchorBrowser({apiKey: process.env.ANCHOR_API_KEY});
  
  const response = await anchor_client.sessions.create({
    session: {
      proxy: {
        type: 'custom',
        server: 'proxy.example.com',
        username: 'myUser',
        password: 'myPassword',
        active: true
      }
    }
  });
  
  console.log('Session created:', response.data);
})().catch(console.error);

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 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.
import AnchorBrowser from 'anchorbrowser';

(async () => {
  const anchor_client = new AnchorBrowser({apiKey: process.env.ANCHOR_API_KEY});
  
  const response = await anchor_client.sessions.create({
    session: {
      proxy: {
        active: true,
        country_code: 'us',
        region: 'ca',
        city: 'los-angeles'
      }
    }
  });
  
  console.log('Session created:', response.data);
})().catch(console.error);

Supported Countries with their Country Codes

AfghanistanafFrancefrNetherlandsnl
AlbaniaalFrench GuianagfNew Zealandnz
AlgeriadzFrench PolynesiapfNicaraguani
AndorraadGabongaNigeriang
AngolaaoGambiagmNorwayno
American SamoaasGeorgiagePakistanpk
Antigua and BarbudaagGermanydePanamapa
ArgentinaarGhanaghParaguaypy
ArmeniaamGibraltargiPerupe
ArubaawGreecegrPhilippinesph
AustraliaauGrenadagdPolandpl
AustriaatGuadeloupegpPortugalpt
AzerbaijanazGuatemalagtPuerto Ricopr
BahamasbsGuernseyggQatarqa
BahrainbhGuineagnRomaniaro
BarbadosbbGuinea-BissaugwSaint Lucialc
BelarusbyGuyanagySan Marinosm
BelgiumbeHaitihtSaudi Arabiasa
BelizebzHondurashnSenegalsn
BeninbjHungaryhuSerbiars
BermudabmIcelandisSeychellessc
BoliviaboIndiainSierra Leonesl
Bosnia and HerzegovinabaIranirSlovakiask
BrazilbrIraqiqSloveniasi
BulgariabgIrelandieSomaliaso
Burkina FasobfIsraelilSouth Africaza
CamerooncmItalyitSouth Koreakr
CanadacaJamaicajmSpaines
Cape VerdecvJapanjpSurinamesr
ChadtdJordanjoSwedense
ChileclKazakhstankzSwitzerlandch
ColombiacoKuwaitkwSyriasy
CongocgKyrgyzstankgSão Tomé and Príncipest
Costa RicacrLatvialvTaiwantw
Côte d’IvoireciLebanonlbTajikistantj
CroatiahrLibyalyTogotg
CubacuLiechtensteinliTrinidad and Tobagott
CypruscyLithuanialtTunisiatn
Czech RepublicczLuxembourgluTurkeytr
DenmarkdkMacedoniamkTurks and Caicos Islandstc
DominicadmMalimlUkraineua
Dominican RepublicdoMaltamtUnited Arab Emiratesae
EcuadorecMartiniquemqUnited Statesus
EgyptegMauritaniamrUruguayuy
El SalvadorsvMexicomxUzbekistanuz
EstoniaeeMoldovamdVenezuelave
EthiopiaetMonacomcYemenye
Faroe IslandsfoMontenegrome
FinlandfiMoroccoma