Quick answer
To use SocksNode residential proxies with Axios, wrap the gateway URL in an https-proxy-agent and pass it as httpAgent and httpsAgent, or use socks-proxy-agent for SOCKS5. Point at global.socksnode.com:9000 for rotating HTTP, or 10000 with a session token for sticky IPs, and set the country token in the username.
Before you start
SocksNode offers residential proxies across 195+ countries over HTTP, HTTPS, and SOCKS5 with username/password auth. Generate credentials for free in the dashboard proxy generator; only routed traffic consumes your prepaid bandwidth (from 5 GB for $4.50, non-expiring on flexible plans).
Axios needs an explicit agent for reliable HTTPS-over-proxy behavior, so use https-proxy-agent rather than the built-in proxy option.
Configure the proxy in Axios
Create an agent and attach it to the request:
For SOCKS5, use socks-proxy-agent with socks5://USERNAME-country-us:[email protected]:11000. Change the country token to target any of 195+ countries.
const axios = require('axios');
const { HttpsProxyAgent } = require('https-proxy-agent');
const agent = new HttpsProxyAgent(
'http://USERNAME-country-us:PASSWORD@global.socksnode.com:9000'
);
(async () => {
const res = await axios.get('https://api.ipify.org', {
httpAgent: agent,
httpsAgent: agent,
});
console.log(res.data);
})();Rotating vs sticky sessions
Rotating sessions assign a new residential IP per request: HTTP port 9000 or SOCKS5 port 11000. Best for spreading many requests across exits.
Sticky sessions hold one IP from 1 minute up to 24 hours: HTTP port 10000 or SOCKS5 port 12000. Reuse one agent built with a token like USERNAME-country-us-session-api3-lifetime-60 so all requests on that agent share the same IP.
Geo targeting with username tokens
Targeting is expressed entirely in the username: country across 195+ countries, US state and city, or ASN/ISP within a country. Only the username in the agent URL changes between regions.
Collect data lawfully, honor each site's terms of service, and respect applicable law and sensible request pacing.
See also
Frequently asked questions
Why use an agent instead of the axios proxy option?
Axios's built-in proxy option is unreliable for HTTPS targets. https-proxy-agent tunnels correctly, so set it as both httpAgent and httpsAgent.
How do I keep the same IP across requests?
Build one agent using port 10000 and a session token like USERNAME-country-us-session-abc-lifetime-60, then reuse that agent so the IP persists for up to 24 hours.
How do I use SOCKS5 with Axios?
Install socks-proxy-agent and create the agent from socks5://USERNAME-country-us:[email protected]:11000 (or 12000 for sticky).
Can I target a country or city?
Yes. Set tokens in the username, such as USERNAME-country-ca or US state and city tokens, across 195+ supported countries.
Do extra credentials use bandwidth?
No. Generating credentials is free; only the traffic routed through the proxy consumes your prepaid bandwidth.


