IPRoyal Residential Proxies Setup Guide: Python, Node.js, and Playwright (2026)
IPRoyal provides residential rotating proxies with a 32M+ IP pool, starting at approximately $7/GB for small purchases and scaling to ~$1.75/GB at 500 GB — with bandwidth that never expires. This guide covers the exact configuration for Python, Node.js, Playwright, and Crawlee.
Freshness note: Endpoint and format verified March 2026. Check IPRoyal dashboard for current credentials format.
Credentials Format
IPRoyal uses a single gateway endpoint with credentials encoded in the URL:
http://USERNAME:PASSWORD@gate.iproyal.com:7777
For geo-targeting, append the country code to your username:
http://USERNAME-country-US:PASSWORD@gate.iproyal.com:7777
For sticky sessions (same IP for multiple requests):
http://USERNAME-country-US-session-RANDOM_ID:PASSWORD@gate.iproyal.com:7777
Generate credentials in the IPRoyal dashboard → Residential Proxies → Access & Authentication.
Python (requests)
Rotating (new IP per request):
import requests
PROXY_USER = "your_username"
PROXY_PASS = "your_password"
PROXY_HOST = "gate.iproyal.com:7777"
proxies = {
"http": f"http://{PROXY_USER}:{PROXY_PASS}@{PROXY_HOST}",
"https": f"http://{PROXY_USER}:{PROXY_PASS}@{PROXY_HOST}",
}
response = requests.get("https://ipinfo.io/json", proxies=proxies)
print(response.json()) # Verify IP and country
Geo-targeted (US residential):
proxies = {
"http": f"http://{PROXY_USER}-country-US:{PROXY_PASS}@{PROXY_HOST}",
"https": f"http://{PROXY_USER}-country-US:{PROXY_PASS}@{PROXY_HOST}",
}
Sticky session (same IP for 30 minutes):
import random
session_id = random.randint(1000, 9999)
proxies = {
"http": f"http://{PROXY_USER}-country-US-session-{session_id}:{PROXY_PASS}@{PROXY_HOST}",
"https": f"http://{PROXY_USER}-country-US-session-{session_id}:{PROXY_PASS}@{PROXY_HOST}",
}
Python (httpx — async)
import asyncio
import httpx
async def scrape(url):
proxies = {
"http://": f"http://{PROXY_USER}:{PROXY_PASS}@{PROXY_HOST}",
"https://": f"http://{PROXY_USER}:{PROXY_PASS}@{PROXY_HOST}",
}
async with httpx.AsyncClient(proxies=proxies) as client:
response = await client.get(url)
return response.text
asyncio.run(scrape("https://ipinfo.io/json"))
Node.js (axios)
import axios from 'axios';
const proxy = {
host: 'gate.iproyal.com',
port: 7777,
auth: {
username: 'your_username',
password: 'your_password',
},
};
const response = await axios.get('https://ipinfo.io/json', { proxy });
console.log(response.data);
Playwright
import { chromium } from 'playwright';
const browser = await chromium.launch({
headless: true,
proxy: {
server: 'http://gate.iproyal.com:7777',
username: 'your_username',
password: 'your_password',
},
});
const page = await browser.newPage();
await page.goto('https://ipinfo.io/json');
const content = await page.$eval('body', (el) => el.textContent);
console.log(JSON.parse(content)); // Verify IP is residential
await browser.close();
With geo-targeting in Playwright:
const browser = await chromium.launch({
proxy: {
server: 'http://gate.iproyal.com:7777',
username: 'your_username-country-DE', // Germany
password: 'your_password',
},
});
Crawlee (ProxyConfiguration)
import { PlaywrightCrawler, ProxyConfiguration } from 'crawlee';
const proxyConfiguration = new ProxyConfiguration({
proxyUrls: [
'http://your_username:your_password@gate.iproyal.com:7777',
],
});
const crawler = new PlaywrightCrawler({
proxyConfiguration,
async requestHandler({ page }) {
const ip = await page.evaluate(() =>
fetch('https://ipinfo.io/json').then((r) => r.json())
);
console.log('IP:', ip.ip, 'Country:', ip.country);
await crawler.pushData(ip);
},
});
await crawler.run(['https://example.com']);
For multiple proxy rotations, add more proxy URLs to the array — Crawlee rotates through them.
Verify Your Proxy is Working
Always verify that your proxy is returning a residential IP before running a full scrape:
response = requests.get("https://ipinfo.io/json", proxies=proxies, timeout=10)
data = response.json()
print(f"IP: {data['ip']}, ISP: {data['org']}, Country: {data['country']}")
# Expected: ISP should be a telecom, not a datacenter
Residential IPs will show ISPs like "Comcast", "Verizon", "Deutsche Telekom" — not AWS, DigitalOcean, or similar.
Cost Estimation
IPRoyal residential proxies are priced by volume (pay-as-you-go, non-expiring): ~$7/GB at 1 GB, ~$5.25/GB at 10 GB, ~$4.90/GB at 50 GB, scaling to ~$1.75/GB at 500 GB. Check current rates.
| Usage | GB consumed | Approx. cost (at ~$7/GB entry) |
|---|---|---|
| 10,000 pages (text) | ~1 GB | ~$7 |
| 10,000 pages (full render) | ~5 GB | ~$26 (at ~$5.25/GB) |
| 100,000 requests | ~10 GB | ~$53 (at ~$5.25/GB) |
