Integration

Use Shifter with Node.js

Drop Shifter's residential and ISP proxies into any Node.js project in minutes. Works seamlessly with axios, the native fetch (Node 18+), got, undici, Puppeteer, and Playwright.

Quick Start

Install

npm install axios https-proxy-agent

Basic Usage

import axios from "axios";
import { HttpsProxyAgent } from "https-proxy-agent";

const proxyUrl =
  "customer-USERNAME-country-us-sid-123ABC:PASSWORD@p.shifter.io:443";
const agent = new HttpsProxyAgent(proxyUrl);

const { data } = await axios.get("https://ipinfo.io/json", {
  httpsAgent: agent,
  proxy: false,
});

console.log(data);
// { ip: "154.16.xxx.xxx", city: "New York", country: "US", ... }

Features

Drop-in support for axios, native fetch, got, undici, node-fetch and any HTTP client that accepts a proxy URL or agent
Per-request rotation by default, with `sid` for sticky sessions and `ttl-N` for timed pins of N seconds
Headless browser support via Puppeteer and Playwright with one-line proxy configuration
HTTP, HTTPS, and SOCKS5 protocols on the same gateway endpoint
Geo-targeting in 195+ countries via username parameters — no extra SDK required
Compatible with TypeScript, ESM, CommonJS, and every Node.js LTS version from 14 onwards

Examples

axios + Geo-Targeted Sticky Session

Pin one residential IP for an entire user session by adding a `sid` to the username. Add `country-uk`, `city-london`, or `asn-7922` to target geographically.

import axios from "axios";
import { HttpsProxyAgent } from "https-proxy-agent";
import { randomBytes } from "node:crypto";

const sid = randomBytes(4).toString("hex");

const proxyUrl =
  `customer-USERNAME-country-uk-city-london-sid-${sid}-ttl-300:` +
  `PASSWORD@p.shifter.io:443`;

const client = axios.create({
  httpsAgent: new HttpsProxyAgent(proxyUrl),
  proxy: false,
  timeout: 30_000,
  headers: {
    "User-Agent":
      "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",
  },
});

const login = await client.post("https://example.com/login", {
  email: "user@example.com",
  password: "secret",
});

const dashboard = await client.get("https://example.com/dashboard");
const orders = await client.get("https://example.com/orders");

console.log(login.status, dashboard.status, orders.status);

Native fetch (Node 18+) with undici

If you're on Node 18 or newer you don't need axios — use the global fetch with an undici ProxyAgent. Smallest possible footprint.

import { ProxyAgent, setGlobalDispatcher } from "undici";

const proxyAgent = new ProxyAgent({
  uri: "http://p.shifter.io:443",
  token: `Basic ${Buffer.from(
    "customer-USERNAME-country-us-sid-456DEF:PASSWORD",
  ).toString("base64")}`,
});

setGlobalDispatcher(proxyAgent);

const r = await fetch("https://api.example.com/products?page=1");
const json = await r.json();

console.log(json);

Puppeteer with Authenticated Proxy

Route Chromium through Shifter and authenticate via page.authenticate(). Combine `sid` with browser-level cookies to keep a stable session for the entire crawl.

import puppeteer from "puppeteer";

const PROXY_HOST = "p.shifter.io";
const PROXY_PORT = 443;
const PROXY_USER = "customer-USERNAME-country-de-sid-789GHI";
const PROXY_PASS = "PASSWORD";

const browser = await puppeteer.launch({
  args: [`--proxy-server=http://${PROXY_HOST}:${PROXY_PORT}`],
  headless: "new",
});

const page = await browser.newPage();
await page.authenticate({ username: PROXY_USER, password: PROXY_PASS });

await page.setUserAgent(
  "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36",
);

await page.goto("https://example.com", { waitUntil: "networkidle0" });

const title = await page.title();
const html = await page.content();

console.log(title, html.length, "bytes");

await browser.close();

Playwright (multi-browser)

Playwright's launch options accept proxies natively, with credentials inline. Same setup works for Chromium, Firefox, and WebKit.

import { chromium } from "playwright";

const browser = await chromium.launch({
  proxy: {
    server: "http://p.shifter.io:443",
    username: "customer-USERNAME-country-fr-city-paris-sid-ABC123",
    password: "PASSWORD",
  },
});

const context = await browser.newContext({
  userAgent:
    "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",
});

const page = await context.newPage();
await page.goto("https://example.com");

const headlines = await page.locator(".headline").allTextContents();

console.log(headlines);

await browser.close();
FAQ

Frequently asked FAQ questions

Common questions about using Shifter with Node.js.

Pass an https-proxy-agent (or http-proxy-agent for plain HTTP) on the httpsAgent option, and set proxy: false to make axios use the agent directly. The proxy URL format is `http://USER:PASS@p.shifter.io:443`. The same axios instance can then be reused across requests.

Get started

Start Using Shifter with Node.js

Add Shifter's 205M+ residential and ISP proxies to your Node.js stack in under 5 minutes. Per-request rotation, sticky sessions, and full Puppeteer / Playwright support.

Try Shifter for FreeSet up in minutes. Cancel anytime.