Proxies

View as Markdown

A proxy routes a runtime’s traffic. Bring your own endpoint, draw from a managed rotating pool, or pin a managed static IP. Attach one to a runtime through runtime configuration.

Create a proxy

A custom proxy you own:

1const proxy = await bctrl.proxies.create({
2 type: "custom",
3 name: "acme-residential",
4 protocol: "http",
5 host: "proxy.acme.com",
6 port: 8080,
7 username: process.env.PROXY_USER!,
8 password: process.env.PROXY_PASS!,
9});

A managed rotating proxy. The config fields are optional - rotation, geo, and device targeting:

1const proxy = await bctrl.proxies.create({
2 type: "managed-rotating",
3 name: "us-rotating",
4 rotation: "rotating",
5 country: "us",
6 preference: "balanced",
7});

A managed static IP from a pool:

1const proxy = await bctrl.proxies.create({
2 type: "managed-static",
3 name: "us-residential",
4 poolId: "pool_us_residential",
5 autoRenew: true,
6});

List, test, delete

1const { data } = await bctrl.proxies.list();
2const one = await bctrl.proxies.get(proxy.id);
3
4const result = await bctrl.proxies.test(proxy.id);
5
6await bctrl.proxies.delete(proxy.id);

Managed pools

Browse the managed proxy catalog by country, category, and availability:

1const pools = await bctrl.proxies.pools.list({ country: "us", available: true });
2const pool = await bctrl.proxies.pools.get("pool_us_residential");

Attach to a runtime

1const runtime = await bctrl.runtimes.create({
2 type: "browser",
3 name: "main",
4 config: { proxy: { mode: "saved", id: proxy.id } },
5});

Next