Guide
How to Use an HTTP or SOCKS5 Proxy with cURL, Python and Node.js
By IPronix · Updated
Every IPronix proxy uses username and password authentication. Residential, mobile and datacenter gateways have an HTTP port and a SOCKS5 port; a static ISP IP runs HTTP or SOCKS5 one at a time (switch it on the order page — the IP and port stay the same). Static ISP proxies are listed in My Proxies; residential, mobile and datacenter traffic goes through a gateway host, with your targeting (country, region, city, session) built into the credentials or into an endpoint list from the dashboard. The examples below use the documentation address 203.0.113.10 and placeholder credentials; replace them with your own.
1. Build the proxy URL
Most tools accept a single proxy URL: scheme, credentials, host and port. Use http:// with the HTTP port and socks5h:// with the SOCKS5 port (different ports on traffic gateways; on a static ISP IP, switch the protocol first and use the same port). The h in socks5h means DNS is resolved by the proxy, so the target's hostname never leaks to your local resolver.
http://USER:PASS@203.0.113.10:8000
socks5h://USER:PASS@203.0.113.10:8001If the password contains characters such as @, : or /, URL-encode it first (encodeURIComponent in JavaScript, urllib.parse.quote in Python).
2. cURL
# HTTP proxy
curl -x http://USER:PASS@203.0.113.10:8000 https://api.ipify.org?format=json
# SOCKS5 proxy (DNS resolved by the proxy)
curl -x socks5h://USER:PASS@203.0.113.10:8001 https://api.ipify.org?format=jsonThe response shows the IP address the website sees. It should be the proxy's IP, not yours.
3. Python (requests)
import requests
proxy = "http://USER:PASS@203.0.113.10:8000"
proxies = {"http": proxy, "https": proxy}
r = requests.get("https://api.ipify.org?format=json", proxies=proxies, timeout=30)
print(r.json())For SOCKS5, install the SOCKS extra and change the scheme:
# pip install "requests[socks]"
proxy = "socks5h://USER:PASS@203.0.113.10:8001"
proxies = {"http": proxy, "https": proxy}4. Node.js (axios)
import axios from "axios";
import { HttpsProxyAgent } from "https-proxy-agent";
const agent = new HttpsProxyAgent("http://USER:PASS@203.0.113.10:8000");
const { data } = await axios.get("https://api.ipify.org?format=json", {
httpsAgent: agent,
proxy: false, // let the agent handle the proxy
});
console.log(data);For SOCKS5, use socks-proxy-agent instead:
import { SocksProxyAgent } from "socks-proxy-agent";
const agent = new SocksProxyAgent("socks5h://USER:PASS@203.0.113.10:8001");
const { data } = await axios.get("https://api.ipify.org?format=json", {
httpAgent: agent,
httpsAgent: agent,
proxy: false,
});5. Fixing common errors
- 407 Proxy Authentication Required: the username or password is wrong, or a special character in the password was not URL-encoded.
- Connection refused or reset right away: the port and protocol do not match, for example a SOCKS5 URL pointed at the HTTP port. Copy the port for the protocol you use.
- 407 on a traffic product: check that the whole password was copied, including the targeting part after the key; an unsupported country, region or city is rejected.
- Traffic requests stop working: the package may be used up. Check the remaining traffic in the dashboard and buy more.
- A static ISP IP shows as pending: it is still being assigned and appears on the order once it is ready.
For static ISP proxies you can also check that a proxy responds, and see its latency, with the ping button on the order page.