Skip to content

JavaScript / Node.js

axios

import axios from 'axios';
const response = await axios.get('https://httpbin.org/ip', {
proxy: {
host: 'connect.trueproxies.com',
port: 8080,
auth: { username: 'your_username', password: 'your_password' },
},
});
console.log(response.data);

node-fetch

import fetch from 'node-fetch';
import { HttpsProxyAgent } from 'https-proxy-agent';
const agent = new HttpsProxyAgent(
'http://your_username:your_password@connect.trueproxies.com:8080'
);
const response = await fetch('https://httpbin.org/ip', { agent });
const data = await response.json();
console.log(data);

Native fetch (Node.js 18+)

import { ProxyAgent } from 'undici';
const proxyAgent = new ProxyAgent(
'http://your_username:your_password@connect.trueproxies.com:8080'
);
const response = await fetch('https://httpbin.org/ip', {
dispatcher: proxyAgent,
});
const data = await response.json();
console.log(data);

SOCKS5

import axios from 'axios';
import { SocksProxyAgent } from 'socks-proxy-agent';
const agent = new SocksProxyAgent(
'socks5://your_username:your_password@connect.trueproxies.com:1080'
);
const response = await axios.get('https://httpbin.org/ip', {
httpsAgent: agent,
});
console.log(response.data);

Country Targeting

Append -country-XX to your username:

const agent = new HttpsProxyAgent(
'http://your_username-country-us:your_password@connect.trueproxies.com:8080'
);

Sticky Sessions

const agent = new HttpsProxyAgent(
'http://your_username-session-abc123:your_password@connect.trueproxies.com:8080'
);